Introduction
All operations in Payrails are defined and executed with customized Workflows, which are lists of steps to be performed in sequence. Thepayment-acceptance workflow, for example, is a list of steps for accepting payments, and you must create an execution of this workflow via the Payrails API before initiating a payment.
After creating an execution, you can Lookup payment options to present to your customer.
Steps
1. Make a POST request
Make aPOST request to the Create a workflow execution endpoint.
In your request, make sure to include:
merchantReference: The merchant-provided reference for the execution. This is commonly the identifier of the order in the merchant’s system.
initialActions.
For example:
2. Receive response
The API response for creating an execution will include the following:id: The unique identifier for this executionstatus: Business-case dependent set of status tags of this execution.
3. Continue with the payment lifecycle
Once you’ve created a workflow execution, you can proceed with the payment in two ways:- If you know the payment method and/or instrument that should be used (because you included the lookup into the
initialActionsor because it is set by your configurations (e.g. default set by customer):- Authorize a payment with the selected payment method and instrument.
- Lookup payment options
- This is for cases in which you’ll present payment options to your customer based on rules you’ve configured in the Payrails Portal, and authorize the payment after they’ve selected a payment option and provided an instrument.
- Important: if you have meta fields specified in Payment options configuration in the portal, they must be included in the request.