Process payins from stored payment methods
Process payins from stored payment methods for recurring payments or subscriptions
Rainforest supports processing payments with stored payment methods. There are a few ways to create payment methods that can be used for recurring payments or subscriptions in the Rainforest ecosystem:
- Integrate the Rainforest Payment Component to process a payin, which will create a payment method associated to the payin.
- Integrate the Rainforest Payment Component to a store payment method.
- Migrate payment methods from another processor.
Once a payment method has been created, you'll want to store the Payment Method ID in your system.
Your platform can build a subscription model or utilize a 3rd party subscription provider to know when to initiate the payment against the stored payment method.
How to process a payin
There are two steps to process a payin from a stored payment method:
- Create a payin config to configure details such as the amount and metadata.
- Process a payin from a stored payment method given the payin config ID and payment method ID.
Billing contact requirements
The following billing contact fields are required for processing depending on the payment method type:
Payment Method | Billing Contact Required Field |
---|---|
Card | postal_code |
ACH | name |
Confirm your stored payment method has the above billing contacts by utilizing the get payment method endpoint.
If the billing contact is missing the requirements, then you should populate the billing contact fields on the create payin config request.
If the billing contact is not missing the requirements, then we will auto-populate the billing contact from the payment method when processing the payment.
Check the payin status
The process a payin from a stored payment method request will return the result of the payin in the API response.
Processing
If the payment is successful, the payin status will be Processing.
{
"status": "SUCCESS",
"data": {
"payin_id": "sbx_pyi_2yb6AB2JHrKn2VV1sPCkIJykzYK",
"...
+ "status": "PROCESSING",
...
},
"errors": null
}
Failed
If the payment is declined, the payin status will be Failed and the refusal code will give additional context on the decline.
{
"status": "SUCCESS",
"data": {
"payin_id": "sbx_pyi_2yb6IFImNlTJ1valHqOM4eQcMiG",
...
+ "status": "FAILED",
+ "refusal_code": "INSUFFICIENT_FUNDS",
+ "refusal_desc": "Insufficient funds",
...
},
"errors": null
}
Depending on the refusal reason, your platform should retry the payment or reach out to the end user for a new payment method.
Updated 4 days ago