mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 17:37:00 +00:00
Added Stripe client library and POC example
This commit is contained in:
parent
6f8425f8ac
commit
60facb0938
@ -380,6 +380,12 @@
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.25.0-GA</version>
|
||||
</dependency>
|
||||
<!-- Stripe client library. It is a payment gateway. -->
|
||||
<dependency>
|
||||
<groupId>com.stripe</groupId>
|
||||
<artifactId>stripe-java</artifactId>
|
||||
<version>12.1.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package code.paymetngateway
|
||||
|
||||
import java.util
|
||||
import java.util.Map
|
||||
|
||||
import com.stripe.Stripe
|
||||
import com.stripe.exception.StripeException
|
||||
import com.stripe.model.PaymentIntent
|
||||
|
||||
|
||||
object StripeExample {
|
||||
def main(args: Array[String]): Unit = {
|
||||
// Set your secret key: remember to change this to your live secret key in production
|
||||
// See your keys here: https://dashboard.stripe.com/account/apikeys
|
||||
Stripe.apiKey = "sk_test_ksWQ0..."
|
||||
val paymentIntentParams = new util.HashMap[String, Any]
|
||||
paymentIntentParams.put("amount", 999)
|
||||
|
||||
paymentIntentParams.put("currency", "sek")
|
||||
val payment_method_types = new util.ArrayList[String]
|
||||
payment_method_types.add("card")
|
||||
paymentIntentParams.put("payment_method_types", payment_method_types)
|
||||
paymentIntentParams.put("receipt_email", "marko@tesobe.com")
|
||||
|
||||
try {
|
||||
val paymentIntent = PaymentIntent.create(paymentIntentParams.asInstanceOf[Map[String, Object]])
|
||||
println(paymentIntent)
|
||||
} catch {
|
||||
case e: StripeException => e.printStackTrace()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user