`
sillycat
  • 浏览: 2539774 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Stripe Payment(1)Introduction Of Payments and Docs

 
阅读更多
Stripe Payment(1)Introduction Of Payments and Docs

Test Card Number
https://stripe.com/docs/testing#cards

1. Checkout form
https://stripe.com/docs/tutorials/checkout

The data will be sent to Stripe and Stripe will auto post a token to our server side.
    <form action="http://requestb.in/w8djhzw8" method="POST">
      <script
        src="https://checkout.stripe.com/checkout.js" class="stripe-button"
        data-key="pk_test_rRej93hjdXTW9TaWUGSv1odD"
        data-amount="2000"
        data-name="Demo Site"
        data-description="2 widgets ($20.00)"
        data-image="/128x128.png"
        data-locale="auto">
      </script>

2. Charge the Customer
https://stripe.com/docs/tutorials/charges

https://stripe.com/docs/api#create_charge

Try with Java API in Scala
The Dependency
  "com.stripe"       % "stripe-java" % "1.37.0",                     //MIT

The JAVA Codes
package com.sillycat.stripe

import java.util

import com.stripe.Stripe
import com.stripe.model.Charge

object StripeApp extends App{

  Stripe.apiKey = "sk_test_xxxxxxx"

  val token = "tok_xxxxxxxxxxx"

  val chargeParams = new util.HashMap[String, Object]()
  chargeParams.put("amount", new Integer(400))
  chargeParams.put("currency", "usd")
  chargeParams.put("source", token)
  chargeParams.put("description", "Charge for test@example.com")

  val charge:Charge = Charge.create(chargeParams)
  println(charge)
}

Stripe tokens can only be used once.

All the APIs are here.
https://stripe.com/docs/api/java#capture_charge

3. Creating Subscription
https://stripe.com/docs/tutorials/subscriptions

We first create plan, and the plan can be day, week, month or year.
https://stripe.com/docs/api/java#create_plan

Then we subscribe a customer to a plan.
https://stripe.com/docs/api/java#create_customer

4. Share Charges
https://stripe.com/docs/connect/payments-fees

https://stripe.com/docs/api#create_account

First of all, Go to [Connect] and Register my Platform Settings.

The flow I tried:

1. Step 1. Create platform account for Sillycat. (platform)

2. Step 2. Use API to create connect account in Sillycat for Kiko. (third party application name)
3. Step 3. End user Carl post payment 20$ to Kiko in browser(Can be our iOS or Android application)
4. Step 4. There is a web hook that once the payment is sent, our HTTP API Server side will receive a token from Stripe.
5. Step 5. Using that payment token, we will create a user account for the end user Carl and receiving a customer token.
6. Step 6. In the web hook HTTP Server, we will call stripe JAVA API with the customer token to split the payment 20$ into 10$ to customer account Kiko (No transaction fee from stripe), 0.88$ into stripe(Transaction fee), 9.12$ into platform account Sillycat.

Some Notes:
1. We can create many other connect accounts, like Kiko2, Kiko3 and etc.
2. We can save the customer token for future payment. We can charge the customer any time we need.

Here is the core codes in sillycat-stripe
package com.sillycat.stripe

import java.util

import com.stripe.Stripe
import com.stripe.model.{Customer, Account, Charge}

object StripeApp extends App{

  Stripe.apiKey = "sk_test_M1rxxxxx" // luohuazju
  //Stripe.apiKey = "sk_test_35ffxxxxxx" //cluo

  val token = "tok_16qnxxxxxx"

//  //Creating an account
//  val accountParams = new util.HashMap[String, Object]()
//  accountParams.put("managed", java.lang.Boolean.FALSE)
//  accountParams.put("country", "US")
//  accountParams.put("email", "cluo@jobs2careers.com")
//
//  Account.create(accountParams)

//  //fetch Account
//  val result = Account.retrieve()
//  println(result)

  //create customer
//  val customerParams = new util.HashMap[String, Object]()
//  customerParams.put("description", "Customer for test@example.com")
//  customerParams.put("source", token)
//
//  Customer.create(customerParams)

  //list Customers
//    val customerParams = new util.HashMap[String, Object]()
//    customerParams.put("limit", new Integer(3))
//
//    val results = Customer.all(customerParams)
//    println(results)

  //Charge
  val chargeParams = new util.HashMap[String, Object]()
  chargeParams.put("amount", new Integer(1000))
  chargeParams.put("currency", "usd")
  //chargeParams.put("source", token)
  chargeParams.put("customer", "cus_74xxxxxx")
  chargeParams.put("description", "Charge for cluo@example.com")

  chargeParams.put("destination", "acct_16qmbxxxxx")
  chargeParams.put("application_fee", new Integer(500))

  val charge:Charge = Charge.create(chargeParams)
  println(charge)
}

References:
http://www.kuqin.com/shuoit/20150728/347262.html stripe with swift

official document
https://stripe.com/docs

https://stripe.com/docs/api#create_charge
分享到:
评论

相关推荐

    stripe-payment-intents:学习如何使用Stripe API

    在stripe-payment- go run server.go目录中,键入go run server.go以启动中间件。 WebHooks的条带化CLI stripe login完成浏览器上的登录。 stripe listen --forward-to http://localhost:3000/webhook观察来自运行...

    stripe-php-7.25.0_stripe_stripe支付PHP_国际stripe支付_payment支付_stripe

    7. **安全性**: Stripe遵循PCI DSS(Payment Card Industry Data Security Standard)标准,确保所有支付数据的安全传输和存储,降低了支付过程中的风险。 8. **错误处理**: PHP SDK提供了丰富的错误处理机制,当...

    stripe-card-payment_stripe_stripecardpayment_

    在"stripe-card-payment"项目中,我们看到以下几个关键文件: 1. `global.css`:这是一个全局CSS样式表,用于定义项目的样式规则,包括按钮、表单、布局等,以确保页面的视觉一致性。 2. `checkout.html`:这是...

    vue-stripe-payment-Stripe的jquery.payment的Vue包装器。-Vue.js开发

    通过npm进行演示安装:yarn add vue-stripe-payment-或-npm install vue-stripe-payment使用此插件向您的应用程序添加vue-stripe-payment就像其他插件一样简单:从'vue'导入Vue; 从'vue-stripe-p导入...

    springboot-stripe-demo.zip

    使用springboot 开发Stripe支付的一个demo,大家可以下载参考一下,博客地址:https://blog.csdn.net/maxi1234/article/details/105002346

    react-native-stripe-payments:轻巧,易于集成且可使用React本机库进行符合SCA(强大的客户身份验证)的Stripe付款(使用Payment Intents)

    安装$ yarn add react-native-stripe-payments $ npx react-native link react-native-stripe-payments该库附带需要与React Native一起编译的平台本机代码。这需要您配置可通过完成的构建工具。用法设置首先,您必须...

    opencart3 stripe 支付插件

    - `upload/catalog/controller/extension/payment/stripe.php` 和 `upload/admin/controller/extension/payment/stripe.php`:分别对应于前台和后台的控制器,处理用户支付请求和管理员的设置操作。 - `upload/...

    laravel-stripe-example:如何在Laravel项目中集成Stripe Payment Gateway

    标题"laravel-stripe-example:如何在Laravel项目中集成Stripe Payment Gateway"表明我们讨论的主题是关于在使用Laravel框架构建的Web应用中整合Stripe支付网关的过程。Stripe是一个流行的在线支付处理平台,它提供了...

    flutter_stripe_payment:带有条纹支付插件集成的Flutter插件

    stripe_payment 使用Stripe方便地保护付款方式。 快速浏览 这个Flutter插件是React Native的tipsi-stripe插件的直接移植-我们试图保持API尽可能接近,因此文档中应用了此插件。 从用户的Card Input和** Apple&...

    OpenCart paypal+stripe[内嵌+跳转] 支付接口

    1. **安装扩展**:首先,你需要找到并下载适合 OpenCart 3.x 的 PayPal 和 Stripe 扩展。这些通常可以在 OpenCart 市场或其他第三方插件市场找到。提供的压缩包“opencart-3-x”可能包含了这些扩展的安装文件。 2. ...

    stripe-payments:使用Stripe API进行付款

    1. **安装Stripe库**: 首先,我们需要在项目中引入Stripe的JavaScript库。可以通过CDN链接或者npm包管理器安装。例如,在HTML文件中添加: ```html &lt;script src="https://js.stripe.com/v3/"&gt;&lt;/script&gt; ``` 2. *...

    Easy E-Commerce Using Laravel And Stripe 2015

    Easy E-Commerce Using Laravel And Stripe 2015 Lean Publishing 2015 by W. Jason Gilmore and Eric L. Barnes

    Magento-Stripe-Payments:接受Stripe付款在Magento 1

    Magento 1的条纹信用卡扩展安装说明在安装扩展程序之前,请确保已禁用Magento缓存,并且已关闭编译。 还强烈建议在将扩展部署到生产之前,首先将其安装在测试/过渡环境中。下载扩展从GitHub下载zip文件。将文件复制...

    Laravel开发-stripe

    **Laravel 开发与 Stripe 集成** 在 Laravel 框架中集成 Stripe 支付系统是一项常见的任务,尤其对于构建电子商务网站或其他需要在线支付功能的 Web 应用程序。Stripe 是一个流行的付款处理平台,它允许开发者轻松...

    Laravel开发-stripe-laravel

    **Laravel 开发与 Stripe 集成** 在 Laravel 框架中,Stripe 是一个常用的支付处理库,尤其适用于在线订阅服务和一次性付款。Stripe 提供了一个简单易用的 API,使得开发者能够轻松地在应用程序中添加支付功能。本...

    Go-stripe-GoclientfortheStripeAPI

    本文将重点介绍使用Go语言实现的Stripe API客户端库——Go-stripe,以及如何利用这个库来高效地与Stripe API进行交互。 首先,让我们理解什么是Go-stripe。Go-stripe是针对Stripe API开发的一个Golang客户端库,它...

    stripe-checkout-sample-code_stripe_phpstripedemo_

    Stripe是一家知名的在线支付处理平台,为开发者提供便捷的API接口,使得集成支付功能变得简单。在给定的压缩包文件中,“stripe-checkout-sample-code_stripe_phpstripedemo_”显然是一个PHP版本的Stripe Checkout...

    亚马逊克隆:构建亚马逊克隆:Nodejs + MongoDB + Stripe Payment(Udemy课程)

    亚马逊克隆构建Amazon克隆:Nodejs + MongoDB + Stripe Payment(Udemy课程) 参考: https://www.udemy.com/build-an-amazon-clone-nodejs-stripe-elasticsearch/Check git log, branches, pm/history.txt for ...

Global site tag (gtag.js) - Google Analytics