Developer
DocsDeveloperPlatformTicket
  • Overview
  • Guides
    • Accept Payment
      • Payment Types
        • Pre Authorization
        • Tokenization
        • Subscription
      • Build Your Gateway
    • Webhook
      • Transaction
      • Subscription
      • Payout
    • Embedding
      • iFrame
      • Modal Window
      • Mobile Apps
      • Integration Parameter
  • General Information
    • Payment Method
      • Static QR Code
    • Payment Provider
    • Objects
      • Metadata
      • Invoice
      • Contact
  • Testing
  • Plugin Development
  • More Documentations
  • Merchant
  • API Reference
Powered by GitBook
On this page
  • Create a Static QR Code - Gastro Case
  • Step 1: Create a QR Code
  • Step 2: Display the QR Code
  • Step 3: Scan the QR Code
  • Step 4: Gateway
  • Delete a QR Code
  1. General Information
  2. Payment Method

Static QR Code

Payrexx enables you to create Static QR Codes with TWINT payment provider for your own webshop.

PreviousPayment MethodNextPayment Provider

Last updated 10 months ago

Create a Static QR Code - Gastro Case

You can create a Static QR Code with our Merchant API. For simplicity, we will explain it with the example of the QR Code creation.

Step 1: Create a QR Code

Create a QR Code with the mandatory parameters:

The webshopUrl is a mandatory field.

Your QR Code can be scanned using any QR Code scanner.

Step 2: Display the QR Code

After Step 1, you will get a QR Code string in the response of your request. Use this string as src attribute in HTML image tag. Now your QR Code can be displayed as image.

Step 3: Scan the QR Code

If the buyer scans the QR Code using TWINT app, they will be redirected to your webshop URL with the following parameters.

  • qr_code_session_id

  • returnAppScheme (iOS)

  • returnAppPackage (Android)

Example Redirects

Scanned using a TWINT app

  • iOS: https://{{webshopUrl}}?qr_code_session_id={{session}}&returnAppScheme={{appName}}

  • Android: https://{{webshopUrl}}?qr_code_session_id={{session}}&returnAppPackage={{appName}}

Scanned using a regular QR code scanner app

  • https://{{webshopUrl}}

Step 4: Gateway

In Gateway creation you need to pass the QR Code session ID and the "return app" parameter:

$gateway->setQrCodeSessionId($_GET['qr_code_session_id']);
if ($_GET['returnAppScheme']) {
    $returnApp = 'returnAppScheme=' . $_GET['returnAppScheme']; // iOS
} else if ($_GET['returnAppPackage']) {
    $returnApp = 'returnAppPackage=' . $_GET['returnAppPackage']; // Android
}
$gateway->setReturnApp($returnApp);

In the Gateway response you will get the TWINT app link:

{
  "status": "success",
  "data": [
    {
      "transactionId": "100",
      "appLink": "intent://payment#Intent;action=ch.twint.action.TWINT_PAYMENT;scheme=twint;S.code=12345;S.startingOrigin=EXTERNAL_WEB_BROWSER;S.browser_fallback_url=;end", // Android
      // "appLink": 'twint-issuer1://applinks/?al_applink_data={"app_action_type": "TWINT_PAYMENT","extras": {"code": "12345",},"referer_app_link": {"target_url": "", "url": "", "app_name": "EXTERNAL_WEB_BROWSER"}, "version": "6.0" }' // iOS
    }
  ]
}

Once you received the appLink in the response, you need to open it. So the TWINT app will be automatically opened for the buyer.

Scan the QR Code (Other App / Camera)

Other as in the TWINT app case you have to create the Gateway with the following redirect URLs.

$gateway->setSuccessRedirectUrl('https://www.merchant-website.com/success');
$gateway->setFailedRedirectUrl('https://www.merchant-website.com/failed');
$gateway->setCancelRedirectUrl('https://www.merchant-website.com/cancel');

Delete a QR Code

Once the buyer has selected their products on your webshop and is ready to pay, you have to with the corresponding amount and currency (optional: basket).

Parallel to this you have to start a transaction polling using the transactionId in the response and the endpoint. You can perform the GET request every second until the transaction status changes from initiated to confirmed or cancelled. Once the status has changed, you can show the corresponding result page on your webshop.

If the customer scans the QR Code other than TWINT app, they will also be redirected to your webshop url. But without special parameters. When the buyer is ready to pay in your webshop, you have to .

You will receive a link in the Gateway response as mentioned . You just need to open the link. The buyer will be redirected to Payrexx Gateway page. There the buyer can choose their preferred payment method and do the payment. Once the payment is done, they will be redirected to the URL which is set in the Gateway creation.

You can delete the QR Code using endpoint.

When cancelling the order process in your webshop you also have to destroy the session to prevent possible payments after cancellation. You can delete the QR Code Scan using endpoint by setting the session ID (see Step 3: Scan the QR Code).

Create a QR Code
Create a Gateway
Retrieve a transaction
Create a Gateway
here
Delete a QR Code
Delete a QR Code Scan