SMS to Payment [VIPPS Payment Provider PoC]
- 1 Flow Diagram
- 2 Flow Description
- 3 Additional feature for enabling payment confirmation SMS
- 4 Architectural Overview of the Client Server Demo App
- 4.1 REST API (CGI)
- 4.2 Client Server App
- 4.3 Paycore SDK
- 4.4 NEXT Paycore API
- 5 Client Server Demo App
- 6 Testing the SMS2VIPPS Direct Payment Flow
- 6.1 Test Case:
- 6.1.1 1. Send CHARGE to 27222 short number
- 6.1.1.1 1.1 ClientServer/KeywordSent function gets executed
- 6.1.1.2 1.2 Creates Pre-Transaction in Paycore Database
- 6.1.1.3 1.3 And creates Transaction in Paycore Database with the same id and the reserved amount
- 6.1.1.4 1.4 Creates new entry in Client Server Database with msisd, transactionId and StartChargeUtc
- 6.1.2 2. Receive VIPPS link for reservation of amount: 5 NOK / KR
- 6.1.3 3. Pay Reserved amount following the SMS link
- 6.1.4 4. Use service for 1 hour (1 hour is assumed amount: 1 NOK / KR)
- 6.1.5 5. Send ENDCHARGE to 27222 short number
- 6.1.5.1 5.1 ClientServer/KeywordSent function gets executed
- 6.1.5.2 5.2 Updates Client Server Database entry with msisd, transactionId, StartChargeUtc and EndChargeUtc.
- 6.1.5.3 5.3 Updates the transaction in Paycore Database with the new amount and or captures the transaction with the whole reserved or newly calculated amount.
- 6.1.6 6. Check VIPPS app, notice you have been charged amount: 1 NOK / KR
- 6.1.7 7. Additionally, if the Send a receipt SMS upon successful payment additional option has been enabled for the partner, upon successful payment, end user will receive confirmation SMS with the configured text from the above Additional feature for enabling payment confirmation SMS section in this document. By configuring that exact text the user will receive an SMS with the actual charged amount.
- 6.1.8 8. When they click on the link they will be redirected to the receipt with actual charged amount (e.g. 5 NOK / KR for 5 hours of used service).
- 6.1.1 1. Send CHARGE to 27222 short number
- 6.1 Test Case:
- 7 Jira tasks
Flow Diagram
Flow Description
In order to perform a direct payment using VIPPS, the following actions need to be performed:
User sends CHARGE to 27222
Call to REST API (CGI) is made
REST API (CGI) makes call to a Client Server Function
Based on the keyword sent a call to NEXT Paycore API is made (Paycore SDK is being used):
If CHARGE, than:
Make a POST call to /api/pre-transactions and send sms with vipps reservation page for the user to pay.
User clicks on the link and pays the reserved amount.
Pre-transaction and transaction is created in NEXT Paycore Database and transactionId is being returned to the Client Server app.
New entry in Client Server Database is created with msisd, transactionId and StartChargeUtc date and time
If ENDCHARGE, than:
Update Client Server database EndChargeUtc data and time column.
Calculate the amount to be charged in the Client Server App and based on the msisd, transactionId and StartChargeUtc and EndChargeUtc (client logic for calculation)
Get the transaction with transactionId from Paycore Database using GET /api/transactions/partnerId/transactionId
If reserved amount is greater than calculated amount to be charged, than:
Make a PUT call to /api/transactions/partnerId/transactionId/capture?amount=amount to update the amount to be charged and capture transaction for the updated amount.
Else, if reserved amount is less than the newly calculated amount to be charged, make a PUT call to /api/transactions/partnerId/transactionId/capture and capture the whole reserved amount.
User checks the transactions and can confirm that they were charged the newly calculated amount.
Additional feature for enabling payment confirmation SMS
Additionally, we have the option to configure the feature to send a confirmation SMS to end user after sending ENDCHARGE when payment has been captured. That option is configurable through the NEXT portal (or directly in the Paycore database).
Client can enable/disable the confirmation SMS and change the text being send if they:
Log into Next portal and go to Mobile Invoice
2. Click on Setup.
3. Find the Partner for which you want this VIPPS confirmation SMS on captured transaction to be sent and click on the edit button next to it.
4. Scroll down to the Sms receipt section. Here, by ticking the Send a receipt SMS upon successful payment tick-box, you can choose to enable the SMS confirmation to be sent. By changing the Text for the receipt message in the below textbox you can change the confirmation SMS text.
The Text for the receipt message is customizable and the {{amount}} will be resolved with the actual charged amount. In addition to the {{amount}}, you can choose to send an URL to the receipt page, using {{receiptPageUrl}} (e.g. Thank you for using our service. You have been charged {{amount}} NOK / KR. For receipt click here: {{receiptPageUrl}}).
A list of parameters that could be use in the paycore SMS texts could be found on the following Confluence page: Parameters used in Paycore/Setup for Paycore SMS text
Note, if you change this, it will be applied to all payments for the particular partner account. If you choose to enable confirmation SMS none of the payments for them will be “silence”.
Architectural Overview of the Client Server Demo App
REST API (CGI)
REST API (CGI) documentation:
Receive - https://linkmobility.no/wp-content/uploads/sites/3/2019/06/SMS_REST_API_MO-1.7.pdf
Send - https://linkmobility.no/wp-content/uploads/sites/3/2019/06/SMS_REST_API_MT_DLR-1.20.pdf
Client Server App
REST API (CGI) binds to an HTTP triggered Azure function deployed in Azure under:
Subscription: Link Mobile Development(Converted to EA)
Resource Group: Dev-PaymentCore
Function App: clientServer
Function: KeywordSent
Database Server: dev-paymentcore.database.windows.net
SQL Database: demo-dp-client-database
Paycore SDK
Client Server client app calls NEXT Paycore API through an updated version of the Paycore SDK uploaded on: https://www.myget.org/feed/linknorway/package/nuget/LinkMobility.PaymentCore.Sdk
PM> Install-Package LinkMobility.PaymentCore.Sdk -Version 2.1.8 -Source https://www.myget.org/F/linknorway/api/v3/index.json
POST /api/pre-transactions using using LinkMobility.PaymentCore.Sdk.BasePaymentController.CreateDirectPaymentAsync(PreTransactionRequest preTransaction, CancellationToken cancellationToken);
GET /api/transactions/partnerId/transactionId using LinkMobility.PaymentCore.Sdk.BasePaymentController.GetTransactionAsync(int partnerId, string transactionId, CancellationToken cancellationToken);
PUT /api/transactions/partnerId/transactionId/capture using LinkMobility.PaymentCore.Sdk.BasePaymentController.CaptureTransactionAsync(int partnerId, Guid transactionId, CancellationToken cancellationToken);
PUT /api/transactions/partnerId/transactionId/capture?amount=amount using LinkMobility.PaymentCore.Sdk.BasePaymentController.UpdateAndCaptureTransactionAsync(int partnerId, Guid transactionId, decimal amount, CancellationToken cancellationToken);
NEXT Paycore API
NEXT Paycore API Documentation: Payment API - Developer Documentation
Client Server Demo App
The ClientServer demo project is uploaded on tfs under the newly created project and repo. There is publicly accessible version of it available on GitHub. See links below:
DirectPayment.Function project (TFS)
https://tfs-linkmobility.visualstudio.com/DirectPayment.Function
Git repository (TFS)
https://tfs-linkmobility.visualstudio.com/_git/DirectPayment.Function
Git repository (GitHub)
https://github.com/marsenovska-LinkMobility/DirectPayment.Function
Testing the SMS2VIPPS Direct Payment Flow
Test Case:
1. Send CHARGE to 27222 short number
1.1 ClientServer/KeywordSent function gets executed
1.2 Creates Pre-Transaction in Paycore Database
1.3 And creates Transaction in Paycore Database with the same id and the reserved amount
1.4 Creates new entry in Client Server Database with msisd, transactionId and StartChargeUtc
2. Receive VIPPS link for reservation of amount: 5 NOK / KR
3. Pay Reserved amount following the SMS link
3.1 Sets transaction to Authorized Transaction in Paycore Database, so that it can be later on captured
4. Use service for 1 hour (1 hour is assumed amount: 1 NOK / KR)
5. Send ENDCHARGE to 27222 short number
5.1 ClientServer/KeywordSent function gets executed
5.2 Updates Client Server Database entry with msisd, transactionId, StartChargeUtc and EndChargeUtc.
5.3 Updates the transaction in Paycore Database with the new amount and or captures the transaction with the whole reserved or newly calculated amount.
6. Check VIPPS app, notice you have been charged amount: 1 NOK / KR
7. Additionally, if the Send a receipt SMS upon successful payment additional option has been enabled for the partner, upon successful payment, end user will receive confirmation SMS with the configured text from the above Additional feature for enabling payment confirmation SMS section in this document. By configuring that exact text the user will receive an SMS with the actual charged amount.
Alternatively, they can choose to also send the link to the receipt page. In such cases, the received SMS upon successful payment will look similar to the following. Hence, charged amount varies depending on the service usage time (5 NOK / KR equals 5 hours of service usage).
8. When they click on the link they will be redirected to the receipt with actual charged amount (e.g. 5 NOK / KR for 5 hours of used service).
Jira tasks
https://linkmobile.atlassian.net/browse/NEXT-915
https://linkmobile.atlassian.net/browse/NEXT-955
https://linkmobile.atlassian.net/browse/NEXT-970
https://linkmobile.atlassian.net/browse/NEXT-999
https://linkmobile.atlassian.net/browse/NEXT-1013
https://linkmobile.atlassian.net/browse/NEXT-1036
https://linkmobile.atlassian.net/browse/NEXT-1037
https://linkmobile.atlassian.net/browse/NEXT-1038
Feeling lost? Click on this link! Portal page