Create payment
When creating a payment, a payment token will be provided in the response. The token is then used by the client to complete the payment.
To receive callbacks on asynchronous payment updates, pass"callback": true
your-authorization
should be replaced with your Authorization header, see Accessyour-user-id
in the URI, should be replaced with your identifier of the usercardAlias
is the alias of the selected payment method, see payment methods
info
- A payment with a given id can only be processed once
- If id is omitted at creation it will be generated, if an id is provided it needs to be system unique
- The payment token is valid for one hour
- orderRows are mandatory for invoice payments but can be included for all payments. If included, the sum of
grossUnitPrice × quantity of orderRows need to be same as the payment amount
Payment Plan
When using payment method of type private invoice, you can optionally provide a payment plan campaign code to make it a payment plan:
- Get payment plan options and select one.
- Use the selected payment plan
campaignCode
aspaymentPlanCampaignCode
when creating the payment.
Request
POST /v1/users/$(your-user-id)/payments
Content-Type: application/json
Accept: application/json
Authorization: $(your-authorization)
Request Body schema: application/json
Payment details
object (PaymentCreateDto) | |||||||||||||||||||
|
application/json
{- "payment": {
- "id": "7e16763b-9517-05a7-75d9-fcad069f54a7",
- "merchantId": "sdk-test-merchant",
- "cardAlias": "sdk-test-swish",
- "amount": 123.12,
- "currency": "SEK",
- "purchaseReference": "350266"
}
}
Response
Success
Response Schema: application/json
object (PaymentDto) | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
paymentToken | string |
application/json
{- "paymentToken": "paymentToken",
- "payment": {
- "id": "7e16763b-9517-05a7-75d9-fcad069f54a7",
- "merchantId": "sdk-test-merchant",
- "type": "PAYMENT",
- "status": "CREATED",
- "created": "2020-09-04T11:42:18+0200",
- "cardAlias": "sdk-test-swish",
- "cardType": "SWISH",
- "amount": 123.12,
- "currency": "SEK",
- "purchaseReference": "350266"
}
}
Error responses
Please refer to our HTTP response codes and Error codes to learn what error responses you may expect from the API.
Example
- curl
- Python
- Java
- C#
- Node.js
Try it
Loading...