Glase payment in your app
To integrate your app with Glase, you need to add Glase payment in your “Check out” process where your customer normally selects between payment methods.
All apps offering payments typically have a backend that handles the actual service/product that is sold. It is this backend that must connect to Glase using our interface, and the communication between your app and your backend is up to your app developer.
Example of shopping and payment flow in your app and Glase app
Follow these steps to integrate your app with Glase:
- Implement the required methods
- Insert the payment URL
- Present the receipt
- Verify your integration
- Go live!
Implement the required methods
The flow for an app Glase payment is very similar to Basic Glase payment. The difference is that the user presses a “pay” button or link in your app, which launches the Glase app and presents the bill for the user to confirm the payment. You still need to request the status of the payment after your app returns (with backURL), but only once to find out the final status of the invoice.
The methods required in a basic integration are:
|sendInvoice||Sends an invoice to Glase server|
|getPaymentStatus||Obtains status of a previously submitted invoice|
|refundPayment||Refunds a previous payment, partly or the whole sum|
For an extended integration, also these methods can be used:
|updateInvoice||Updates an already sent invoice with new set of invoice rows or attributes|
|cancelInvoice||Cancels an unpaid invoice|
|markTransactionPeriod||Marks the end of one and the beginning of a new transaction period; used in reporting|
|executeReport||Executes a report on Glase server|
Refer to section API for detailed description.
For the sendInvoice request you must include the backURL and notificationUrl (the backURL is set to ‘done’ page, and the notificationUrl calls the getPaymentStatus request.)
The backURL will redirect the user to your app after successful or canceled payment. Typically this will be a URL to a webpage or with a URL scheme that launches or returns to your app. Also provide a backend call to your server where you must acknowledge that payment has been done - this is more secure than using only the backURL since the user might exit the flow as soon as the payment has gone through (and the flow is not yet completed).
The backURL is only used if the user is making a purchase through a browser on their mobile device. The ‘done’ page simply makes a final getPaymentStatus call and displays the output in the page.
If user will press cancel in Glase app then invoice will get canceled. The backURL will still be called. getPaymentStatus will respond will status CANCELED.
For example code of sendInvoice with backURL and notificationUrl, refer to Webshop.
Insert the payment URL
Make a redirection (button or link) in your app, which launches the Glase app, using the QR code URL returned from the sendInvoice request: Replace the “HTTP:” header with “seqr:” that is, if sendInvoice returns HTTP://SEQR.SE/R12345, the button/link should instead use seqr://SEQR.SE/R12345 .
Present the receipt
Once the payment is completed, your app should query the status of the invoice from Glase by calling getPaymentStatus. If the invoice was successfully paid, a reference number (ersReference) is obtained from Glase. Save the reference number for follow-ups and for print on the user online confirmation receipt.
Verify your integration
Verify that your integration works and run validation tests towards Glase servers. Contact Glase for more information.