Merchant-initiated transactions
You can perform MIT using the Secure Fields. The steps to execute the payment depend on two factors:
- Whether you are dealing with a subscription or an unscheduled payment.
- Whether it's the first time the payment method, such as the card, is being used or it was used before.
Subscription
If you need to create payments for a subscription, first, you need to create a subscription plan using the Create Subscription endpoint. When you create the subscription plan, you define characteristics such as the frequency and the amount of payments.
First payment
After creating the subscription, you must collect your client's payment information data to execute the first payment. In this case, you will follow the step-by-step process previously presented in Secure Fields (Payment). In Step 6, you will save the card data using the vault_on_success feature. In this scenario, when creating the payment in Step 6, you need to inform reason = SUBSCRIPTION
and usage = FIRST
. Access stored credentials for more information.
However, if you have enrolled in a payment method previously using the Secure Fields (Enrollment), you can skip the collection of payment method information. In this scenario, after finishing Step 3 of Secure Fields (Payment) and creating the subscription plan, you need to retrieve the payment method information using the Retrieve Enrolled Payment Methods to get the vaulted_token
from the chosen payment method. Then, you can jump to Step 7 to create the payment. When creating the payment in Step 6, you need to inform reason = SUBSCRIPTION
and usage = FIRST
, if it's the first time using the payment method, or usage = USED
if it was used before. Access stored credentials for more information.
Subsequent payments
From the second payment onwards, you don't need to follow all the steps presented in Secure Fields (Enrollment). Since it's an operation that only depends on the backend execution, you can skip Steps 1 and 2 and execute all operations using Yuno API endpoints. To execute the payment, you will need to follow the steps:
- Create checkout session.
- Retrieve the enrolled payment method to get the
vaulted_token
from the chosen payment method. - Create the payment. In this step, you need to inform
reason = SUBSCRIPTION
andusage = USED
. For more information, access stored credentials.
Unscheduled payment
In unscheduled payments, no subscription plans are required. The merchant initiates the transaction without the client's interference using a card token created in previous operations.
If you have the card token (vaulted_token
), you can execute the payment without interaction with the client and using only the Yuno API endpoints. To execute the payment, follow the steps below:
- Create checkout session.
- Retrieve the enrolled payment method to get the
vaulted_token
from the chosen payment method. - Create the payment. In this step, you need to inform
reason = UNSCHEDULED_CARD_ON_FILE
andusage = FIRST
, if it's the first time using the payment method, orusage = USED
if it was used before. Access stored credentials for more information.
If you don't have access to the card token, you can:
- Follow the step-by-step presented in Secure Fields (Enrollment), but you need to inform
reason = UNSCHEDULED_CARD_ON_FILE
in Step 6. - First, execute the payment method enrollment using the Secure Fields (Enrollment), and then execute the three steps described for the unscheduled payment.
Updated 8 months ago