Integrate SDK on application side

After installing and initializing SDK:

  1. Initialize the payment UI specifying the payment method ID and redirect URL:
    • The headlessCheckout.form.init method returns an object used for further interaction with the payment UI.
    • The redirect URL is used to redirect the user, for example, after completing the 3-D Secure verification.
Example:
Copy
Full screen
Small screen
await headlessCheckout.form.init({
  paymentMethodId: ID,
  returnUrl: 'returnUrl',
});
  1. Add the following components to the HTML markup of the payment UI:
    • Mandatory components:
      • psdk-legal — to display information about legal documents.
      • psdk-total — to display the total purchase amount.
    • Payment form components. You can either use the built-in psdk-payment-form component or manually create payment UI elements using the ready-to-use components.
    • The payment button component — psdk-submit-button.
Example:
Copy
Full screen
Small screen
<psdk-legal></psdk-legal>
<psdk-total></psdk-total>


<psdk-payment-form></psdk-payment-form>
<psdk-submit-button text="Pay"></psdk-submit-button>
  1. Add the handling of the check_status event for the payment status change.
Example:
Copy
Full screen
Small screen
headlessCheckout.form.onNextAction((nextAction) => {
  switch (nextAction.type) {
    case 'check_status': {
      showStatus = true;
    }
  }
});
  1. Add the psdk-status component to the HTML markup of the payment UI to display a payment status.
Example:
Copy
Full screen
Small screen
@if (showStatus) {
  <psdk-status></psdk-status>
}
Was this article helpful?
Thank you!
Is there anything we can improve? Message
We’re sorry to hear that
Please explain why this article wasn’t helpful to you. Message
Thank you for your feedback!
We’ll review your message and use it to help us improve your experience.
Last updated: March 4, 2025

Found a typo or other text error? Select the text and press Ctrl+Enter.

Report a problem
We always review our content. Your feedback helps us improve it.
Provide an email so we can follow up
Thank you for your feedback!