A Rehive service to handle stripe payment processing.
Requires the following permissions in Rehive:
permissions |
---|
admin.company.view |
admin.asset.view |
admin.transactionsubtypes.view |
admin.transactionsubtypes.add |
admin.account.view |
admin.transaction.add |
admin.transaction.change |
The service encapsulates 2 Stripe flows:
- Checkout setup (payement details collection) : https://stripe.com/docs/payments/checkout/collecting
- Payment intent creation : https://stripe.com/docs/payments/payment-intents
A summary of the stripe payment processor flow:
- CLIENT -> POST to
/user/sessions/
with a mode ofsetup
. - CLIENT -> Redirect the user to the Stripe interface with returned session id.
- SERVER -> Awaits completetion of the session and updates the session details.
- CLIENT -> POST to
/user/payments/
with anamount
,currency
,payment_method
. - SERVER -> Initiates a payment using the payment method.
- SERVER -> Awaits completion of the payment and updates its details.
- CLIENT -> Pings the server for updates on the payment and then displays a message.
Between step 6 and 7, an additional 3D Secure step may be required from the CLIENT. Whether 3D Secure is required can be checked using the next_action
object. If it contains redirect_to_url
as the type
then 3D Secure confirmation should be triggered by the CLIENT.
An example next_action
can be seen bellow:
{
type: 'redirect_to_url',
redirect_to_url: {
url: 'https://hooks.stripe.com/...',
return_url: 'https://example.com'
}
}
The relevant 3D Secure docs can be found here: https://stripe.com/docs/payments/3d-secure#manual-redirect