Store an alternative payment instrument like PayPal or GoCardless for future use.
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.
redirect_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
.
approval_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
.
payment-method
resource with its updated status.