The ePayment PSP API is not yet available. This documentation describes the upcoming functionality.
ePayment PSP API guide
PSPs can process card payments through their own infrastructure using CARD_PASSTHROUGH as the payment method type. When the user selects a card in the Vipps MobilePay app, the card token is sent to your callback URL. You process the payment and respond with the result.
This page covers the PSP-specific additions.
The ePayment API covers the full breadth of the underlying platform β including detailed flow diagrams, user journey walkthroughs, and advanced features that apply to PSP integrations as well.
Flowβ
With CARD_PASSTHROUGH, the payment creation flow is:
- PSP creates a payment with
paymentMethod.type: CARD_PASSTHROUGHand acardPassthroughobject specifying your callback URL (cardCallbackUrl). - The user is redirected to the Vipps MobilePay app and selects a card.
- Vipps MobilePay sends the card token (or encrypted PAN) to
cardCallbackUrlsynchronously. - PSP processes the payment using their own payment processing systems and responds within 20 seconds.
- The user is redirected to your
returnUrl. - PSP updates the payment status in Vipps MobilePay.
PSP merchant payment flow
- PSP creates a payment with Vipps MobilePay (POST /epayment/v1/payments with cardPassthrough).
- Vipps MobilePay returns the payment created response with a redirectUrl to PSP.
- PSP redirects user to Vipps MobilePay.
- User selects a card and confirms the payment.
- Vipps MobilePay posts a card token to the PSP's cardCallbackUrl.
- PSP processes the payment using the token.
- PSP returns 200 OK to Vipps MobilePay.
- Vipps MobilePay redirects the user to the returnUrl.
- PSP updates the payment status with Vipps MobilePay (POST /epayment/v1/payments/).
Endpointsβ
PSPs can use all ePayment API endpoints with the Psp-Id header added to every request. The only endpoint requiring PSP-specific configuration is POST:/epayment/v1/payments.
The following table shows how ePayment endpoints are used in a PSP CARD_PASSTHROUGH integration.
| ePayment endpoints | PSP usage and notes |
|---|---|
Create payment:POST:/epayment/v1/payments | Create CARD_PASSTHROUGH payment with Psp-Id and cardPassthrough callback fields. See Create payment. |
Update the payment status:POST:/epayment/v1/payments/{reference}/capturePOST:/epayment/v1/payments/{reference}/refundPOST:/epayment/v1/payments/{reference}/cancel | Communicate capture, refund, and cancel status to Vipps MobilePay. Payment processing happens in PSP/acquirer systems. See Update the payment status. |
Check the payment status:GET:/epayment/v1/payments/{reference}GET:/epayment/v1/payments/{reference}/events | Optional: compare current state/amounts with PSP records and decide if updates are needed. See Check the payment status. |
Create paymentβ
The payment flow is user-initiated. The user selects a card in the Vipps MobilePay app, and Vipps MobilePay calls your cardCallbackUrl synchronously with the card token. You process the payment and respond with the result, then update us with the outcome.
Send a POST:/epayment/v1/payments request with the required parameters. Set paymentMethod.type to CARD_PASSTHROUGH and include the cardPassthrough object.
Example request (PSP-specific fields are highlighted):
curl -X POST https://apitest.vipps.no/epayment/v1/payments \
-H "Content-Type: application/json" \
-H "Psp-Id: YOUR-PSP-ID" \
-H "Authorization: Bearer YOUR-ACCESS-TOKEN" \
-H "Ocp-Apim-Subscription-Key: YOUR-SUBSCRIPTION-KEY" \
-H "Merchant-Serial-Number: YOUR-MSN" \
-H "Idempotency-Key: YOUR-IDEMPOTENCY-KEY" \
-d '{
"amount": {
"currency": "NOK",
"value": 6000
},
"customer": {
"phoneNumber": "4712345678"
},
"paymentMethod": {
"type": "CARD_PASSTHROUGH"
},
"cardPassthrough": {
"pspReference": "payment-ref-123456",
"cardCallbackUrl": "https://example.com/psp-callback",
"allowedCardTypes": ["VISA_DEBIT", "VISA_CREDIT", "DANKORT", "MC_CREDIT", "MC_DEBIT"],
"publicEncryptionKeyId": "3f1c2e90-7a4b-4c9d-8f21-6b3e2d7a91c4"
},
"reference": "acme-shop-123-order123abc",
"userFlow": "WEB_REDIRECT",
"returnUrl": "https://example.com/redirect?orderId=1512202",
"paymentDescription": "Purchase of socks"
}'
When the user confirms the payment in the Vipps MobilePay app and selects their card, Vipps MobilePay sends a card token to your cardCallbackUrl. See Card callback for the request format, HMAC authentication, and expected response.
Once you've processed the payment, update payment status so that the Vipps MobilePay app will show the user the correct status.
Parametersβ
Required header parameters
Authorization- Bearer-Authorization. The access token is a base64-encoded string that is required for all API calls.Idempotency-Key- Idempotency key for the request, ensures idempotent actions. See IdempotencyOcp-Apim-Subscription-Key- The subscription key for a sales unit. See API keys.Merchant-Serial-Number- The Merchant Serial Number is a unique identifier that is defined when a sales unit is created. See How to find the Merchant Serial NumberPsp-Id- Only used by Payment Service Providers. If you are a PSP, see PSP ePayment integration.
There are several optional HTTP headers
that are helpful for debugging (e.g., Vipps-System-Name).
Required body parameters
paymentMethod.type- Must be set toCARD_PASSTHROUGH.cardPassthrough- Supply values as described incardPassthrough.amount- Amount object, containing a value and a currency. The minimum amounts allowed are: NOK 100 ΓΈre, DKK 1 ΓΈre, EUR 1 cent. The allowed currencies are these string values:"NOK","DKK","EUR","SEK","USD","GBP". PSPs are not limited to using the currency registered for the sales unit.reference- The reference is the unique identifier for the payment, specified when initiating the payment. The reference must be unique for the sales unit (MSN), but is not globally unique, so several MSNs may use the same reference. See the orderId / reference recommendations.userFlow- The normal flow isWEB_REDIRECT. See ePayment API:userFlowfor more details.customer- Required foruserFlowofPUSH_MESSAGE. The customer phone number or login token.returnUrl- Required foruserFlowofWEB_REDIRECT. The URL the user is returned to after the payment session. The URL must use the https:// scheme or a custom URL scheme.
cardPassthroughβ
The cardPassthrough object is required when creating a CARD_PASSTHROUGH payment.
| Field | Required | Description |
|---|---|---|
pspReference | Yes | Your unique reference for this payment. |
cardCallbackUrl | Yes | URL where we send the user's card data. See Card callback for the expected request and response format. |
allowedCardTypes | Yes | Card types the user can select. Values: VISA_DEBIT, VISA_CREDIT, MC_CREDIT, MC_DEBIT, DANKORT. |
preferVisaPartOfVisaDankort | No | When true, prefer the Visa part of a Visa/Dankort co-branded card. Default: false. |
publicEncryptionKeyId | No | GUID of your public key registered with us. When provided, we encrypt the PAN in the card callback. If not provided, only tokens are returned. |
Update payment statusβ
Use these ePayment endpoints to keep us aligned with the payment state in your PSP/acquirer systems β both immediately after processing and later for captures and refunds.
Include your PSP identifier in the Psp-Id header.
POST:/epayment/v1/payments/{reference}/capture- Use this when the payment has been captured in your systems. We register that the payment has been captured.
POST:/epayment/v1/payments/{reference}/refund- Use this when the payment has been refunded in your systems. We register that the payment has been refunded.
POST:/epayment/v1/payments/{reference}/cancel- Use this when remaining authorized funds are cancelled in your systems, or to prevent the user from completing a payment that has not yet been authorized. We cancel the payment in the Vipps MobilePay app.
Check the payment statusβ
For reconciliation, you can optionally use:
Card callbackβ
The card callback applies to the payment creation flow. When the user confirms the payment in the Vipps MobilePay app and selects their card, we send a POST request to your cardCallbackUrl. You must respond within 20 seconds.
Usually the callback will include a card token and a cryptogram. If you provided your publicEncryptionKeyId in the initial request the callback may instead include an encrypted PAN depending on the availability of generating a token for the card.
Key behaviors:
- The callback is synchronous β we expect a response with the payment authorization result.
- If your response indicates a retryable error, the user can retry with the same or a different card.
- HTTP 500 errors and timeouts are treated as non-retryable.
- For timeouts we will show the user an error message notifying them to check the status of the order with the merchant.
Callback requestβ
We send a POST request to your cardCallbackUrl with the following properties:
pspReference: Your unique reference for this payment, as provided in the create payment request.authorizationAttemptId: Unique identifier for this authorization attempt.merchantSerialNumber: The merchant serial number for the payment.amount: Object containing the payment amount:value: The amount in minor units.currency: The three-letter ISO 4217 currency code.
softDeclineCompletedRedirectUrl: URL to redirect to after a soft decline is resolved.cardInfo: Object containing the card details:maskedCardNumber: The masked card number (for example,47969485XXXX1234).cardType: The card type (for example,VISA-DEBIT).cardIssuedInCountryCode: The ISO 3166-1 alpha-2 country code where the card was issued.cardDataType: The type of card data included in the callback. Possible values areTOKENorPAN.networkToken: Object containing the network token details whencardDataTypeisTOKEN:number: The token number.cryptogram: The cryptogram for the transaction.expiryMonth: Token expiry month.expiryYear: Token expiry year.tokenType: Token network type (for exampleVISA).eci: Electronic Commerce Indicator.paymentAccountReference: Stable reference across token renewals.
encryptedPan: Encrypted PAN whencardDataTypeisPAN.
For example:
POST /psp-makepayment HTTP/1.1
Host: example.com
Content-Type: application/json
{
"pspReference": "7686f7788898767977",
"authorizationAttemptId": "d8f9a1d7-b9d3-4c2f-b5c2-7d8b93df12ab",
"merchantSerialNumber": "123456",
"amount": {
"value": 49900,
"currency": "NOK"
},
"softDeclineCompletedRedirectUrl": "https://vipps.no/mobileintercept?transactionId=123456789&responsecode=OK",
"cardInfo": {
"maskedCardNumber": "47969485XXXX1234",
"cardType": "VISA-DEBIT",
"cardIssuedInCountryCode": "DK",
"cardDataType": "TOKEN",
"networkToken": {
"number": "5000000000000000001",
"cryptogram": "aFgdgjdkfgjdFDF=",
"expiryMonth": "03",
"expiryYear": "2030",
"tokenType": "VISA",
"eci": "7",
"paymentAccountReference": "5001BO8B9NXVVIXCT0HAJU98I512Z"
},
"encryptedPan": null
}
}
HMAC authenticationβ
To verify that the callback originates from us and has not been tampered with, we sign each callback using HMAC with a shared secret.
The shared secret is your PSP client secret.
Use the shared secret together with the Host, x-ms-date, x-ms-content-sha256, and Authorization headers of the request.
How HMAC works
- Secret key: A secret key is shared between the sender and the receiver.
- Message: The message to be authenticated.
- Hash function: A cryptographic hash function such as SHA-256 is used.
- HMAC generation:
- The message and the secret key are combined in a specific way.
- The combined data is hashed using the cryptographic hash function.
- The result is the HMAC value.
- Verification:
- The receiver uses the same secret key and hash function to generate an HMAC value for the received message.
- The receiver compares the generated HMAC value with the HMAC value sent with the message.
- If they match, the message is verified as authentic and unaltered.
Example callback requestβ
You will receive an HTTP POST with this format:
POST https://example.com/psp-makepayment
Host: example.com
x-ms-date: Thu, 30 Mar 2023 08:38:32 GMT
x-ms-content-sha256: WyZnKtAizV4gkGbiMMhm2NIrvlumpic9Zdjcqs6Q2hw=
Authorization: HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature=RwcYy13oXAu1ZFU1zOi0MmSIHynnNnHe9lwNx+LgMqc=
X-Vipps-Authorization: HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature=RwcYy13oXAu1ZFU1zOi0MmSIHynnNnHe9lwNx+LgMqc=
Content-Type: application/json
{"pspReference":"7686f7788898767977","authorizationAttemptId":"3030303thisisaguid","merchantSerialNumber":"123456"}
X-Vipps-Authorization contains the same value as Authorization. You can verify either header, but they should match when both are present.
How to verify the callbackβ
-
Check that the content has not been modified
Hash the exact request body as UTF-8 using SHA-256, then base64 encode it. This hash must match the
x-ms-content-sha256header. Use the raw body exactly as received. Re-serializing the JSON may change whitespace and produce a different hash. -
Verify the authentication header
Concatenate the request method, path and query, date, host, and content hash in this format:
POST\n<pathAndQuery>\n<date>;<host>;<hash>The
hostvalue must match theHostheader, including the port if one is present.Please note the use of
\nnot\r\n.Sign the string with HMAC-SHA256 using your shared secret. This must match the
Signaturepart of theAuthorizationheader.
Sample codeβ
The following examples show how to validate the callback request:
- JavaScript
- .Net C#
'use strict';
const assert = require('node:assert');
const { describe, it } = require('node:test');
const crypto = require('crypto');
describe('Sample code', () => {
it('Verifying card callback HMAC headers', () => {
const secret = 'A0+AeKBRG2KRGvnNwJpQlb6IJFk48CKXCIcrLoHncVJKDILsQSxS6NWCccwWm6r6FhGKhiHTBsG2wo/xU6FY/A==';
const request = {
method: 'POST',
url: 'https://example.com/psp-makepayment',
pathAndQuery: '/psp-makepayment',
headers: {
'Host': 'example.com',
'x-ms-date': 'Thu, 30 Mar 2023 08:38:32 GMT',
'x-ms-content-sha256': 'WyZnKtAizV4gkGbiMMhm2NIrvlumpic9Zdjcqs6Q2hw=',
'Authorization': 'HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature=RwcYy13oXAu1ZFU1zOi0MmSIHynnNnHe9lwNx+LgMqc=',
'X-Vipps-Authorization': 'HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature=RwcYy13oXAu1ZFU1zOi0MmSIHynnNnHe9lwNx+LgMqc='
},
content: '{"pspReference":"7686f7788898767977","authorizationAttemptId":"3030303thisisaguid","merchantSerialNumber":"123456"}'
};
const expectedContentHash = crypto
.createHash('sha256')
.update(request.content, 'utf8')
.digest('base64');
assert.equal(
request.headers['x-ms-content-sha256'],
expectedContentHash,
'Content hash was not valid');
const expectedSignedString =
`${request.method}\n` +
`${request.pathAndQuery}\n` +
`${request.headers['x-ms-date']};${request.headers['Host']};${request.headers['x-ms-content-sha256']}`;
const expectedSignature = crypto
.createHmac('sha256', secret)
.update(expectedSignedString, 'utf8')
.digest('base64');
const expectedAuthorization =
`HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature=${expectedSignature}`;
assert.equal(expectedAuthorization, request.headers.Authorization, 'Authorization was not valid');
assert.equal(request.headers['X-Vipps-Authorization'], request.headers.Authorization, 'Headers did not match');
});
});
using System.Security.Cryptography;
using System.Text;
public class SampleCode
{
public void Verifying_Card_Callback_Hmac_Headers()
{
var secret = "A0+AeKBRG2KRGvnNwJpQlb6IJFk48CKXCIcrLoHncVJKDILsQSxS6NWCccwWm6r6FhGKhiHTBsG2wo/xU6FY/A==";
var request = new
{
Method = "POST",
Url = "https://example.com/psp-makepayment",
PathAndQuery = "/psp-makepayment",
Headers = new Dictionary<string, string>
{
{ "Host", "example.com" },
{ "x-ms-date", "Thu, 30 Mar 2023 08:38:32 GMT" },
{ "x-ms-content-sha256", "WyZnKtAizV4gkGbiMMhm2NIrvlumpic9Zdjcqs6Q2hw=" },
{
"Authorization",
"HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature=RwcYy13oXAu1ZFU1zOi0MmSIHynnNnHe9lwNx+LgMqc="
},
{
"X-Vipps-Authorization",
"HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature=RwcYy13oXAu1ZFU1zOi0MmSIHynnNnHe9lwNx+LgMqc="
}
},
Content = """{"pspReference":"7686f7788898767977","authorizationAttemptId":"3030303thisisaguid","merchantSerialNumber":"123456"}"""
};
var contentHashInBytes = SHA256.HashData(Encoding.UTF8.GetBytes(request.Content));
var expectedContentHash = Convert.ToBase64String(contentHashInBytes);
Assert.Equal(expected: expectedContentHash, actual: request.Headers["x-ms-content-sha256"]);
var expectedSignedString =
$"{request.Method}\n" +
$"{request.PathAndQuery}\n" +
$"{request.Headers["x-ms-date"]};{request.Headers["Host"]};{request.Headers["x-ms-content-sha256"]}";
using var hmacSha256 = new HMACSHA256(Encoding.UTF8.GetBytes(secret));
var hmacSha256Bytes = Encoding.UTF8.GetBytes(expectedSignedString);
var hmacSha256Hash = hmacSha256.ComputeHash(hmacSha256Bytes);
var expectedSignature = Convert.ToBase64String(hmacSha256Hash);
var expectedAuthorization = $"HMAC-SHA256 SignedHeaders=x-ms-date;host;x-ms-content-sha256&Signature={expectedSignature}";
Assert.Equal(expected: expectedAuthorization, actual: request.Headers["Authorization"]);
Assert.Equal(expected: request.Headers["Authorization"], actual: request.Headers["X-Vipps-Authorization"]);
}
}
Callback responseβ
Respond with HTTP 200 OK and a JSON body with the following properties:
status(required): The payment authorization result. One of:RESERVE- The authorization succeeded and the amount was reserved.SOFT_DECLINE- Additional cardholder action is required to complete the authorization. IncludesoftDeclineUrl.FAIL- The authorization failed. IncludeerrorCodeanderrorMessage.
networkTransactionReference: Your reference for the network transaction. Include this when the authorization succeeded and you have such a reference.softDeclineUrl: URL the user should be redirected to in order to complete a soft decline flow. Required whenstatusisSOFT_DECLINE.errorCode: Numeric error code describing why the authorization failed. Required whenstatusisFAIL.errorMessage: Human-readable description of the failure. Required whenstatusisFAIL.
Example payloadsβ
RESERVEβ
Use RESERVE when the authorization succeeded and the payment should remain reserved for a later capture.
{
"networkTransactionReference": "123456789",
"status": "RESERVE"
}
SOFT_DECLINEβ
Use SOFT_DECLINE when the cardholder must complete an additional issuer or authentication step before the payment can proceed.
{
"status": "SOFT_DECLINE",
"softDeclineUrl": "https://example.com"
}
FAILβ
Use FAIL when the authorization did not succeed and no soft decline flow is available.
{
"status": "FAIL",
"errorCode": 300,
"errorMessage": "Refused by Issuer"
}
Error codesβ
When you respond with status: FAIL, use one of the following errorCode values:
errorCode | Name | Retryable | Description |
|---|---|---|---|
100 | Card Error | Yes | Card-related failure where the card should not be retried unchanged for this payment. |
200 | Insufficient Funds | Yes | The card or account does not have enough available funds to complete the payment. |
210 | Limit Exceeded | Yes | A card, account, or issuer limit has been reached, so the payment cannot be authorized. |
300 | Issuer Declined | Yes | The issuer declined the payment without providing a more specific reason. |
400 | Permanent Decline | No | A hard decline where the payment must not be retried. |
500 | Risk Declined | Yes | The payment was blocked by fraud or risk controls. |
600 | Temporary Technical Error | Yes | A transient PSP, issuer, or network problem prevented the authorization attempt from completing. |
700 | Merchant Configuration Error | No | The payment failed because of merchant, PSP, or transaction configuration issues. |
800 | Duplicate or In Progress | No | The payment is already being processed, or a duplicate attempt was detected, so retrying immediately is not allowed. |
900 | Unknown Error | Yes | The authorization failed, but the reason could not be mapped confidently to a more specific error. |
If we receive a FAIL response, we will allow the user to retry with the same or a new payment source unless the errorCode maps to a non-retryable failure.
If there is a timeout or HTTP 500, the payment cannot be tried again by the user. You will need to initiate a new payment request.
You must return a valid callback response within 20 seconds or the payment will fail.
Special featuresβ
Most ePayment special features work with CARD_PASSTHROUGH without any PSP-specific changes. Add the feature's required fields to your create payment request alongside the standard cardPassthrough fields, and include the Psp-Id header as usual. The card callback and status update flow remain the same.
| Feature | PSP support |
|---|---|
| Express | Supported β see Express below |
| Personal QR | Supported |
| One-time payment QR | Supported |
| Profile sharing | Supported |
| Minimum user age | Supported |
| Set order details | Supported |
| Specify customer present | Supported |
| Add metadata | Supported |
| Long-living payments | Supported |
| Block payment sources | Supported |
| Freestanding cards | Not applicable |
For example, to use Minimum user age, add the minimumUserAge field to the create payment request. Vipps MobilePay verifies the user's age before they can proceed β your cardCallbackUrl is called as normal.
Expressβ
PSPs can use the Express feature with CARD_PASSTHROUGH. The user selects shipping options and shares their profile inside the app; your cardCallbackUrl is still called with the card token for you to process.
To enable it, add the following to your create payment request alongside the standard cardPassthrough fields:
profile.scope:"name address email phoneNumber"(all four values required)shipping: eitherfixedOptionsordynamicOptionsβ see Shipping options
The amount is the base product price; Vipps MobilePay adds the selected shipping cost before the user confirms. After authorization, retrieve shippingDetails and userDetails from GET:/epayment/v1/payments/{reference} (include the Psp-Id header), then capture the full amount.
For full details on shipping options, dynamic callbacks, and button guidelines, see the Express feature guide.
More informationβ
- How it works β visual flows for online, in-store, QR, and freestanding card payment scenarios
- Payment operations β capture, cancel, refund, and more
- ePayment API spec β the full technical specification for all endpoints, including required fields, data types, and valid formats