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 Access
  • your-user-id in the URI, should be replaced with your identifier of the user
  • cardAlias 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 as paymentPlanCampaignCode when creating the payment.

Request

Copy
Copied
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)
id
string
merchantId
string
cardAlias
string
amount
number
currency
string
purchaseReference
string
paymentPlanCampaignCode
number <int64>

WebPay payment plan campaign code

Array of objects (OrderRow)
callback
boolean
application/json
{
  • "payment": {
    }
}

Response

Success

Response Schema: application/json
object (PaymentDto)
id
string
merchantId
string
type
string
Enum: "PAYMENT" "REFUND"
status
string
Enum: "CREATED" "CONFIRMED" "PROCESSING" "AUTHORIZED" "COMPLETE" "CANCELED" "USER_CANCELED" "PAYMENT_FAILED" "TIMEOUT" "SYSTEM_ERROR"
created
string

Created timestamp

cardAlias
string
cardType
string
Enum: "CARD" "SWISH" "WEBPAY_INVOICE" "RECURRING_CARD"
cardSubType
string

Currently only card brands when applicable, more types might be added later

Enum: "VISA" "MASTERCARD" "AMEX" "UNKNOWN"
amount
number
currency
string
purchaseReference
string
paymentPlanCampaignCode
number <int64>

WebPay payment plan campaign code

processorReference
object <string>

Reference used by the processor

processorCompleted
string

Completed time according to the processor. Currently only used for Swish payments

callback
boolean
paymentToken
string
application/json
{
  • "paymentToken": "paymentToken",
  • "payment": {
    }
}
Error responses

Please refer to our HTTP response codes and Error codes to learn what error responses you may expect from the API.

Example

Try it

Loading...