Stripe
Last updated
Was this helpful?
Last updated
Was this helpful?
Stripe.com offers 2 different APIs for payments :
Charge
In our code base we have implemented both APIs. The preferred is the payment intent API.
As of September 2019, a regulation called (SCA) requires businesses in Europe to request additional authentication for online payments. Businesses in Europe must start building their Stripe integrations with the and APIs instead of the Sources API to be ready for these rule changes.
Make a product (when no product exist in your environment) POST /products
Create an order linked to a payment intent POST /stripe/paymentIntents
with in the body the property productId with the value from the product of step 1
In the response body from the request, in step 2, will be the property stripeClientSecret
store its value as well as the orderId
Make sure you can
Use the "stripeClientSecret" (from step 3) in the
Poll the order page with the id (from step 3) GET /orders?id=...
until the response contains the property status
with value task_started
(if it never changes to task_started
, contact the Extra Horizon team)
You have now successfully completed a payment for an order
Make a product POST /products
with the body containing "prices": { "eur": { "amount": 1000 }, "usd": { "amount": 1500 } }
Create an order linked to a payment intent POST /stripe/paymentIntents
with the body containing "productId": ...(from step1), "currency": "usd"
Follow step 3, 4, 5 and 6 from "Complete a basic payment for a basic order"
You have now successfully completed a payment with a currency different from the default (EUR)
In this service we have implemented 4 different payment method types from the stripe.com api: The default payment method type is card
(visa, mastercard, ...). The other 3 supported types are: bancontact
, giropay
and ideal
.
Follow step 1 from "Complete a basic payment for a basic order"
Create an order linked to a payment intent POST /stripe/paymentIntents
with the body containing "productId": ...(from step1), "paymentMethodType": "bancontact"
Follow step 3 and 4 from "Complete a basic payment for a basic order"
Follow step 6 from "Complete a basic payment for a basic order"
You have now successfully completed a payment with a different payment method type (bancontact) than the default (card)
You can repeat the process above but instead of specifying bancontact
as the paymentMethodType (in step 2) specify giropay
or ideal
. You'll need to use the respective confirm...Payment
method in step 4.
First create a payment intent with the setupPaymentMethodReuse
option set to offSession
:
POST /stripe/paymentIntent
Use the returned stripeClientSecret
to complete the payment with Stripe.
Then the payment_method
returned by Stripe can be submitted reuse it later on:
POST /stripe/users/5d3f321b59080100065b2ee7/paymentMethods
Now that the payment method is saved it can be used for future payments.
The saved payment method can be specified during the creation of a payment intent. Adding the paymentMethodId
and offSession: true
to the request make the API try to automatically complete the payment intent:
POST /stripe/paymentIntent
First create a setup intent with the setupPaymentMethodReuse
option set to offSession
:
POST /stripe/setupIntents
Use the returned stripeClientSecret
to complete the setup with Stripe using the confirmCardSetup
method in stripe.js.
Use the "stripeClientSecret" (from step 3) in the
See stripe.com documentation for more information about the confirm..Payment
method: