Search…
Payments
Your Users can pay for Orders and Subscriptions. But they'll need a Payment Method.
When you want to pay, you need to use the Payment object. Together with a Payment Method, among other fields, you’ll be able to create and process payments, as well as list all available payments.

Payment Object

Base
Stripe
Vipps
Attributes
Type
Description
user
object
The user associated with the Payment.
amount
number
Amount as a Float with decimal points. Example: 10.23 USD
amount_paid
number
Amount as a Float with decimal points. Example: 10.23 USD
amount_reserved
number
Amount as a Float with decimal points. Example: 10.23 USD
currency
string
3 letter ISO currency code as defined by ISO 4217.
human_id
string
Human readable ID. 6 characters long.
subject
string
Order or Subscription ID.
current_state
string
Current state of payment. Can be: created, processing, captured, succeeded, failed, cancelled, reserved, refunded, partial_refund, pending_refund, refund_failed and on_retry.
active
boolean
Default is True.
payment_date
object
Date for scheduling payment,timestamp format.
payment_method
string
ID of existing Payment Method.
billing_address
object
The Address object with billing details, for use if supported by payment provider.
description
string
Some additional description, if desired and supported by payment provider.
metadata
array
Additional information on the payment, if supported by payment provider.
status_code
string
If the payment fails, this will have some code from the chosen payment method backend.
error_message
string
If the payment fails, this will have text describing the reason.

Additional Payment attributes

Attributes
Type
Description
metadata.payment_intent.id
string
The Stripe PaymentIntent ID.
metadata.intent_client_secret
string
The Stripe PaymentIntent secret for re-authentication.
You will get those attributes after a payment has been successfully created with a Stripe payment method.

Additional request's Attribute

Attribute
Type
Description
metadata.redirect_url
string
The fallback URL is the URL users will be redirected to after completing a payment through the Vipps App. It can be defined by the client or by the company Vipps setting: default vipps fallback

Additional Payment attributes

Attributes
Type
Description
metadata.vipps_url
string
The URL used to confirm the Vipps phone number and send a payment request to the Vipps APP.
metadata.vipps_auth_token
string
A token generated by BuiltOn while creating a Vipps Payment.
You will get those attributes after a payment has been successfully created with a Vipps payment method.
*Paths listed below with an asterisk are accessible to both User and Admin Roles.

Payment for Orders*

Pay for an Order or multiple Orders at once.
Parameters
HTTP - Stripe
HTTP - Vipps
Arguments
Type
Description
orders
array
List with Orders to be paid.
payment_method
string
Selected Payment Method id to use.
1
Request --
2
3
POST /payments HTTP/1.1
4
Content-Type: application/json
5
Authorization: Bearer <jwt>
6
X-Builton-Api-Key: <builton-api-key>
7
Host: api.builton.dev
8
9
{
10
"orders": [<order_id>],
11
"payment_method": <stripe_payment_method_id>
12
}
Copied!
1
Response --
2
HTTP/1.1 200 OK
3
Content-Type: application/json
4
5
{
6
"company": {
7
"$oid": "57ee9c71d76d431f8511142f"
8
},
9
"created": {
10
"$date": 1476118043580
11
},
12
"_id": {
13
"$oid": "<payment-id>"
14
},
15
"modified": {
16
"$date": 1476118043580
17
},
18
"deleted": false,
19
"user": {
20
"$oid": "57ee9c72d76d431f85111432"
21
},
22
"amount": 450.2,
23
"current_state": "created",
24
"active": true,
25
"human_id": "51Q4LN",
26
"currency": "NOK",
27
"subject": "<order-id>",
28
"payment_method": "<stripe_payment_method_id>",
29
"payment_date": {
30
"$date": 147998016470
31
},
32
"metadata": {
33
"payment_method": "<payment-id>",
34
"payment_intent_id": "stripe-payment-intent-id",
35
"intent_client_secret": "stripe-intent-client-secret"
36
}
37
}
Copied!
1
Request --
2
3
POST /payments HTTP/1.1
4
Content-Type: application/json
5
Authorization: Bearer <jwt>
6
X-Builton-Api-Key: <builton-api-key>
7
Host: api.builton.dev
8
9
{
10
"orders": [<order_id>],
11
"payment_method": <vipps_payment_method_id>,
12
"metadata": {
13
"redirect_uri": "https://your-redirect-uri"
14
}
15
}
Copied!
1
Response --
2
HTTP/1.1 200 OK
3
Content-Type: application/json
4
5
{
6
"company": {
7
"$oid": "57ee9c71d76d431f8511142f"
8
},
9
"created": {
10
"$date": 1476118043580
11
},
12
"_id": {
13
"$oid": "<payment-id>"
14
},
15
"modified": {
16
"$date": 1476118043580
17
},
18
"deleted": false,
19
"user": {
20
"$oid": "57ee9c72d76d431f85111432"
21
},
22
"amount": 450.2,
23
"current_state": "created",
24
"active": true,
25
"human_id": "51Q4LN",
26
"currency": "NOK",
27
"subject": "<order-id>",
28
"payment_method": "<vipps_payment_method_id>",
29
"payment_date": {
30
"$date": 147998016470
31
},
32
"metadata": {
33
"redirect_uri": "https://your-redirect-uri",
34
"vipps_auth_token": 'vipps-token',
35
"vipps_url": "https://apitest.vipps.no/dwo-api-application/v1/deeplink/vippsgateway?v=2&token=vipps-token"
36
}
37
}
Copied!

Retrieve a Payment*

Parameters
Request
Response
Argument
Type
Description
payment-id
string
ID of the queried payment.
1
GET /payments/<payment-id> HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"company": {
6
"$oid": "57ee9c71d76d431f8511142f"
7
},
8
"created": {
9
"$date": 1476118043580
10
},
11
"_id": {
12
"$oid": "<payment-id>"
13
},
14
"modified": {
15
"$date": 1476118043580
16
},
17
"deleted": false,
18
"user": {
19
"$oid": "57ee9c72d76d431f85111432"
20
},
21
"amount": 450.2,
22
"metadata": {},
23
"current_state": "created",
24
"active": true,
25
"human_id": "51rQxLN",
26
"currency": "NOK",
27
"subject": "<invoice-id>",
28
"payment_method": "<payment-method-id>",
29
"payment_date": {
30
"$date": 147998016470
31
}
32
}
Copied!

List all Payments*

Parameters
Request
Response
Query Parameters
Type
Description
size
number
Number of resources per page. Default is 10.
page
number
Defines which page to retrieve. Default is 0.
from_date
number
Start date, timestamp format. Default is None.
to_date
number
End date, timestamp format. Default is None.
sort
string
Field used to sort results.
status
string
Status of the payment.
1
GET /payments HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
[
5
{
6
"company": {
7
"$oid": "57ee9c71d76d431f8511142f"
8
},
9
"created": {
10
"$date": 1476118043580
11
},
12
"_id": {
13
"$oid": "<payment-id>"
14
},
15
"modified": {
16
"$date": 1476118043580
17
},
18
"deleted": false,
19
"user": {
20
"$oid": "57ee9c72d76d431f85111432"
21
},
22
"amount": 450.2,
23
"metadata": {},
24
"current_state": "created",
25
"active": true,
26
"human_id": "51Q4LN",
27
"currency": "NOK",
28
"subject": "57ee9c72d76d431f85111434",
29
"payment_method": "<payment-method-id>",
30
"payment_date": {
31
"$date": 147998016470
32
}
33
}
34
]
Copied!

Update Payment*

Only the below fields are editable in a payment.
Parameters
Request
Response
Arguments
Type
Description
active
boolean
Default is True.
payment_method
string
ID for payment method.
billing_address
string
The Billing Address for they payment method.
payment_date
number
Update payment date, timestamp format.
1
PUT /payments/<payment_id> HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
6
7
{
8
"active": false
9
}
Copied!
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"currency": "NOK",
6
"amount": 390,
7
"active": false,
8
"human_id": "MR998V",
9
"subject": {
10
"_cls": "Invoice",
11
"_ref": "5c641635fd1c45001219e849"
12
},
13
"_id": {
14
"$oid": "5c641640fd1c45001519e84a"
15
},
16
"accounting_reference": "400367",
17
"metadata": {},
18
"deleted": false,
19
"company": {
20
"$oid": "59ce1e0a9d3bde0006fa45a9"
21
},
22
"user": {
23
"$oid": "5c1cc0c3ae702b00123f99fb"
24
},
25
"modified": {
26
"$date": 1552912011146
27
},
28
"created": {
29
"$date": 1550063168924
30
},
31
"current_state": "succeeded"
32
}
Copied!
Last modified 1yr ago