Search…
Payment Methods
To pay for things, your users need to have a payment method in the system. They can add it in their purchasing flow, or have it on file as their default_payment_method , which can be updated in the User Object. The default_payment_method will automatically be set to the last payment method used by the user to pay for an order.
Note: Ensure you update the BuiltOn API when your users add or update a payment method. When done directly through outside payment providers, our APIs won’t be notified and the payment will not be processed or tracked in our system.

Payment Method Object

Attributes
Type
Description
method
string
Currently just stripe and vipps, but more options coming soon.
name
string
Name of the Payment Method. This can be set by the user and/or shown if desired.
user
object
User associated with Payment Method.
Paths listed below and denoted with an asterisk are accessible to both User and Admin Roles.

Retrieve a Payment Method*

Retrieves the payment method with a given ID.
Parameters
Request
Response
payment_method_id
string
This is the unique ID of the queried payment method.
1
GET /payment_methods/<payment_method_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-method-id>"
13
},
14
"modified": {
15
"$date": 1476118043580
16
},
17
"deleted": false,
18
"active": true,
19
"user": {
20
"$oid": "57ee9c72d76d431f85111432"
21
},
22
"method": "stripe",
23
"name": "Stripe",
24
"customer_id": "cus_CJjTlT4Wci2P0u",
25
"source": "pm_1EzglsEeeXxFpLJtjuEvd123",
26
"card": {
27
"object": "card",
28
"address_state": null,
29
"fingerprint": "npPw68vQg1usKUWb",
30
"metadata": {},
31
"exp_year": 2019,
32
"country": "US",
33
"last4": "4242",
34
"address_zip_check": null,
35
"address_zip": null,
36
"funding": "credit",
37
"cvc_check": "unchecked",
38
"id": "card_1Bv5yfEeeXxFpLJtPBVfQ1wZ",
39
"tokenization_method": null,
40
"address_line1": null,
41
"exp_month": 12,
42
"brand": "Visa",
43
"dynamic_last4": null,
44
"address_country": null,
45
"address_line2": null,
46
"address_line1_check": null,
47
"name": null,
48
"address_city": null
49
},
50
"setup_intent": {
51
"id": "seti_SripeSetupIntentID",
52
"client_secret": "seti_StripeSecret",
53
"status": "succeeded"
54
}
55
}
Copied!

List all Payment Methods*

Retrieves a list of all Payment Methods associated with the user.
Parameters
Request
Response
Attribute
Type
Description
size
number
Number of items to retrieve.
page
number
Which page to retrieve. Default page size is 10.
sort
string
Field used for sorting results.
1
GET /payment_methods 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-method-id>"
14
},
15
"modified": {
16
"$date": 1476118043580
17
},
18
"deleted": false,
19
"active": true,
20
"user": {
21
"$oid": "57ee9c72d76d431f85111432"
22
},
23
"method": "stripe",
24
"name": "Stripe",
25
"customer_id": "cus_CJjTlT4Wci2P0u",
26
"source": "pm_1EzglsEeeXxFpLJtjuEvd123",
27
"card": {
28
"object": "card",
29
"address_state": null,
30
"fingerprint": "npPw68vQg1usKUWb",
31
"metadata": {},
32
"exp_year": 2019,
33
"country": "US",
34
"last4": "4242",
35
"address_zip_check": null,
36
"address_zip": null,
37
"funding": "credit",
38
"cvc_check": "unchecked",
39
"id": "card_1Bv5yfEeeXxFpLJtPBVfQ1wZ",
40
"tokenization_method": null,
41
"address_line1": null,
42
"exp_month": 12,
43
"brand": "Visa",
44
"dynamic_last4": null,
45
"address_country": null,
46
"address_line2": null,
47
"address_line1_check": null,
48
"name": null,
49
"address_city": null
50
},
51
"setup_intent": {
52
"id": "seti_SripeSetupIntentID",
53
"client_secret": "seti_StripeSecret",
54
"status": "succeeded"
55
}
56
}
57
]
Copied!

Delete Payment Method*

Parameters
Request
Response
Argument
Type
Description
payment_method_id
string
This is the unique ID of the payment method.
1
DELETE /payment_methods/<payment_method_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-method-id>"
13
},
14
"modified": {
15
"$date": 1476118043580
16
},
17
"deleted": true,
18
"active": false,
19
"user": {
20
"$oid": "57ee9c72d76d431f85111432"
21
},
22
"method": "stripe",
23
"name": "Stripe",
24
"customer_id": "cus_CJjTlT4Wci2P0u",
25
"source": "pm_1EzglsEeeXxFpLJtjuEvd123",
26
"card": {
27
"object": "card",
28
"address_state": null,
29
"fingerprint": "npPw68vQg1usKUWb",
30
"metadata": {},
31
"exp_year": 2019,
32
"country": "US",
33
"last4": "4242",
34
"address_zip_check": null,
35
"address_zip": null,
36
"funding": "credit",
37
"cvc_check": "unchecked",
38
"id": "card_1Bv5yfEeeXxFpLJtPBVfQ1wZ",
39
"tokenization_method": null,
40
"address_line1": null,
41
"exp_month": 12,
42
"brand": "Visa",
43
"dynamic_last4": null,
44
"address_country": null,
45
"address_line2": null,
46
"address_line1_check": null,
47
"name": null,
48
"address_city": null
49
},
50
"setup_intent": {
51
"id": "seti_SripeSetupIntentID",
52
"client_secret": "seti_StripeSecret",
53
"status": "succeeded"
54
}
55
}
Copied!

Stripe Payment Method

Stripe Object

Attributes
Type
Description
source
string
Contains payment method id from Stripe.
card
object
Card's details. e.g: last 4 numbers, expiration year, etc.
setup_intent
object
A Setup Intent object.

Setup Intent Object

Attributes
Type
Description
id
string
The Setup Intent from the payment method provider.
client_secret
string
The client secret key from the payment method provider, helps to validate the creation of a payment method.
status
string
The status of the Setup Intent. e.g.: succeeded, require_payment_method, etc.

Create Stripe Payment Method*

Changes since API version 2019-02-01

2019-07-31 - Stripe SetupIntent object

    Creating a Stripe payment method now needs two requests: 1)POST /payment_methodswith payment_method to ask for an Setup Intent ID. 2)PUT /payment_methods to update the payment method with the Stripe payment method, e.g.: pm_D1as56d14a6
2019-07-24 - SCA Changes
    token has been replaced by payment_method_id **Until the 14th of September 2019**, you can still use the APIs as you've used so far. After this date, if you keep using the old Stripe Tokens to do your payments, you'll be getting errors from the Banks requiring further authentication and you'll have to upgrade your APIs accordingly to use the new Payment Intent APIs. Go to our SCA section to read more.

Ask for a Setup Intent ID

This request will return you an empty payment method object except for a SetupIntent object, where you will find 3 important fields: id, client_secret and status. On your client you will need both the id and client_secret to generate a Stripe payment method, using the Stripe SDK.
Parameters
Request
Response
Attribute
Type
Description
payment_method
string
Must be stripe for a Stripe payment method.
1
POST /payment_methods 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
"payment_method": "stripe"
9
}
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-method-id>"
13
},
14
"modified": {
15
"$date": 1476118043580
16
},
17
"deleted": false,
18
"active": true,
19
"user": {
20
"$oid": "57ee9c72d76d431f85111432"
21
},
22
"method": "stripe",
23
"name": "Stripe",
24
"customer_id": "cus_CJjTlT4Wci2P0u",
25
"source": "",
26
"card": { },
27
"setup_intent": {
28
"id": "seti_SripeSetupIntentID",
29
"client_secret": "seti_StripeSecret",
30
"status": "requires_payment_method"
31
}
32
}
Copied!

Update the Payment Method

After you created a Stripe payment method, you will be able to update the current user's payment method with the Stripe payment method Id.
Parameter
Request
Response
Attribute
Type
Description
payment_method_id
string
Stripe payment method id. Response will contain non sensitive user card details. Refer to Stripe’s docs for payment_methods/create and stripe-js create payment method
1
PUT /payment_methods/<payment_method_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
"payment_method_id": "pm_1EzglsEeeXxFpLJtjuEvd123"
9
}
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-method-id>"
13
},
14
"modified": {
15
"$date": 1476118043580
16
},
17
"deleted": false,
18
"active": true,
19
"user": {
20
"$oid": "57ee9c72d76d431f85111432"
21
},
22
"method": "stripe",
23
"name": "Stripe",
24
"customer_id": "cus_CJjTlT4Wci2P0u",
25
"source": "pm_1EzglsEeeXxFpLJtjuEvd123",
26
"card": {
27
"object": "card",
28
"address_state": null,
29
"fingerprint": "npPw68vQg1usKUWb",
30
"metadata": {},
31
"exp_year": 2019,
32
"country": "US",
33
"last4": "4242",
34
"address_zip_check": null,
35
"address_zip": null,
36
"funding": "credit",
37
"cvc_check": "unchecked",
38
"id": "card_1Bv5yfEeeXxFpLJtPBVfQ1wZ",
39
"tokenization_method": null,
40
"address_line1": null,
41
"exp_month": 12,
42
"brand": "Visa",
43
"dynamic_last4": null,
44
"address_country": null,
45
"address_line2": null,
46
"address_line1_check": null,
47
"name": null,
48
"address_city": null
49
},
50
"setup_intent": {
51
"id": "seti_SripeSetupIntentID",
52
"client_secret": "seti_StripeSecret",
53
"status": "succeeded"
54
}
55
}
Copied!

Vipps Payment Method

Vipps Object

Specific fields for a Vipps payment method object.
Attributes
Type
Description
customer_number
string
Phone number of the customer.

Create Vipps Payment Method

Parameters
HTTP
Attribute
Type
Description
payment_method
string
Must be vipps for a Vipps payment method.
customer_number
string
Phone number of the customer.
1
Request --
2
3
GET https://api.builton.dev/orders/<order_id>?expand=user HTTP/1.1
4
Content-Type: application/json
5
Authorization: Bearer <jwt -or- service-account-key>
6
X-Builton-Api-Key: <builton-api-key>
7
Host: api.builton.dev
8
9
{
10
"payment_method": "vipps",
11
"customer_number": "+47 424 42 424"
12
}
Copied!
1
Response --
2
3
HTTP/1.1 200 OK
4
Content-Type: application/json
5
6
{
7
"company": {
8
"$oid": "57ee9c71d76d431f8511142f"
9
},
10
"created": {
11
"$date": 1476118043580
12
},
13
"_id": {
14
"$oid": "<payment-method-id>"
15
},
16
"modified": {
17
"$date": 1476118043580
18
},
19
"deleted": false,
20
"active": true,
21
"user": {
22
"$oid": "57ee9c72d76d431f85111432"
23
},
24
"method": "vipps",
25
"name": "vipps",
26
"customer_number": "+47 424 42 424"
27
}
Copied!
Last modified 1yr ago