- GoCardless
- PayPal
POST /payment-methods API. The call requires a method, a
redirect_url, a country (optional) and a currency (optional).
Additionally, the API call accepts a buyer_id or buyer_external_identifier
which can be used to associate a card to a previously created buyer.
Step 1. Initialize a new redirect payment method
The first step is to initialize a new redirect payment method. Aredirect_url
needs to be provided to redirect the user back to your application after they
have approved access to their account. However, country and currency are
optional and depend on the service to be used to vault the payment method.
In this example, we will use GoCardless to create a payment method.
payment-method resource for which the status is set to
buyer_approval_required.
POST /payment-methods
Step 2. Redirect the user
For the next step, you will need to redirect the buyer to the URL specified in theapproval_url field of the response.
The buyer then logs in to their account and authorizes it to be used by Gr4vy.
After this, the buyer is redirected back to the redirect_url you specified
earlier. For example:
payment_method_id query parameter represents the ID of the payment method
that this account has been stored as. The status represents the status of the
payment method, which in most cases should be stored.
(Optional) Step 3. Confirm the authorization
Finally, you could make an optional API call to confirm the payment method has been fully stored.payment-method resource with its updated status.
GET /payment-methods/77a76f7e-d2de-4bbc-ada9-d6a0015e6bd5/authorize