Headless SDK (Enrollment)
Yuno's Headless SDK gives you full control over the checkout UX and UI to enroll cards without requiring you to be PCI-compliant.
Enrollment Workflow
The following image describes the complete enrollment workflow. Below, each step is described in detail.
Step 1: Create a customer
First, create a customer. After you create a customer, you can enroll payment methods to their account. You can skip this step if you already have a customer ID received from a previous customer creation.
Use the Create Customer endpoint to create new customers and get a customer id
. The customer id
will be used in the following steps.
Step 2: Create a customer session
Next, create a customer session. Each enrollment needs a new customer session. This session lets you access all available payment methods your customer can enroll in their account.
Use the Create Customer Session endpoint with the customer id
to get a new customer_session
.
Step 3: Retrieve and display payment methods
Query the available payment methods using the Retrieve Payment Methods To Enroll endpoint using the customer_session
. Next, display these methods to the customer so they can select the one they want to enroll.
You can enable or disable payment methods using the Checkout Builder in the Yuno dashboard.
You are responsible for displaying the available payment methods and collecting the necessary payment details from your when using the Headless SDK.
Step 4: Enroll the payment method
Once your customer selects a payment method, call the Enroll Payment Method endpoint. The Yuno system will check if an additional step is needed to complete the enrollment. The endpoint response will return the enrollment.sdk_required_action
parameter:
- If
sdk_required_action = true
: You need to use the Headless SDK to continue the enrollment. The response will include aREADY_TO_ENROLL
status, indicating you need to capture payment details from your customer to complete the enrollment. See Step 5 for further information on what to do. - If
sdk_required_action = false
: The enrollment is complete, and the status will beENROLLED
orDECLINED
.
The Enroll Payment Method endpoint response will also provide the enrollment information and an id
. The id
is the vaulted_token
, which you can save in your system and use to create future payments if the final status received is ENROLLED
.
Step 5: Finish the enrollment using the Headless SDK
This step is only necessary if you have received enrollment.sdk_required_action = true
in Step 4.
Follow these steps to complete enrollment using the Headless SDK to capture and share the details of the payment method with Yuno:
- Include the library in your project.
- Initialize the SDK with the public key.
- Configure the SD by calling
yuno.apiClientEnroll
with the desired configuration. - Use the
apiClientEnroll.continueEnrollment
function to obtain the payment method information, including thevaulted_token
and enrollment status.
PCI Compliance
Please bear in mind that you are capturing sensitive card data. When handling sensitive card data, follow good data management practices. If you are not PCI-certified, do not store card data other than the token provided by the SDK.
For more information on how to initiate Yuno's SDK, refer to one of the following pages according to the corresponding platform:
Step 6: Webhook confirmation
The enrollment process is asynchronous. You should use Webhooksto get the final enrollment status.
At the end of the process, you will receive the enrollment status, enrollment information, and the vaulted_token
, equal to the id
received when in Step 4.
Save the token for future payments
Save the vaulted_token
if the final status is ENROLLED
. Use the token for future payments.
Updated 5 months ago