QR code payment

When paying via QR code, e.g., using WeChat Pay or Alipay, the seller generates a QR code that the user scans with their payment application. After the payment is confirmed and the funds are debited, the seller receives a notification about the successful transaction. This method ensures the payment security, as the user doesn’‎t enter their bank details and all data is processed by the payment system.

To use Headless checkout to accept payments via QR code:

  1. Add the handling of the show_qr_code event for displaying a QR code.

Example:

Copy
Full screen
Small screen
headlessCheckout.form.onNextAction((nextAction) => {
  switch (nextAction.type) {
    case 'show_qr_code': {
      showQrCode = true;
    }
  }
});
  1. Add the psdk-qr-code component to the HTML markup of the payment UI.

Example:

Copy
Full screen
Small screen
@if (showQrCode) {
  <psdk-qr-code></psdk-qr-code>
  <psdk-submit-button text="Show status" />
}
Implementation sample
Refer to the detailed sample on GitHub.
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!