Save payment method
To save a payment method for the future use you need to generate paymentToken
when you create or confirm the payment and then save it on your server. This process is often called tokenization.
Tokenization protects sensitive data through a process of replacing the data with a non-sensitive equivalent, known as a token. The token has no external significance or value. It’s a reference — or identifier — that through a tokenization system, maps back to the sensitive data. This process securely collects sensitive credit card information and prevents data theft.
#
1. Generate payment tokenServer-side
#
When you create a payment - cURL
- Node.js
- PHP
Check all available request parameters.
Server-side
#
When you confirm a payment - cURL
- Node.js
- PHP
Check all available request parameters.
Client-side
#
When you submit a payment form You can pass generatePaymentToken: true
when you submit a payment form. This is useful for allowing your customers to select if they want to save payment method for future use.
Check card payment method integration for more details.
#
2. Obtain and store payment tokenAfter the payment is completed a customer is redirected to the completeUrl
with payment_id query parameter, you can obtain permanent paymentToken
by calling get payment endpoint.
MONEI will notify you about a payment status by sending an HTTP POST request to the callbackUrl
. The request body will contain full payment object in JSON format including permanent paymentToken
.
Store this paymentToken
in your database along with customer information. Next time the customer does a purchase, create a payment with this token to skip payment form. Keep in mind that the customer will still need to complete 3d secure verification.
note
Generated paymentToken
does not expire and should only be used server-side.