Client Session API

Update client session

PATCH
https://api.sandbox.primer.io/client-session

You can update a clients session created earlier with the PATCH /client-session API call.

The only required field for the request is clientToken. Other supported request fields are same as for the POST /client-session API call.

You need to specify only the fields you wish to update. However, if the items that are to be updated are of type array, then you need to provide the complete array along with modified items.

If you wish to update nested fields on the client session, such as the customer emailAddress field, you can pass the customer object with only one field, emailAddress, to update.

If you simply wish to clear the value of the field, pass null as your input.

You can update paymentMethod.vaultOnSuccess field but updating of the paymentMethod.options field through PATCH /client-session is not supported.

The response will contain all the fields of the client session including the ones that were changed.

Request

This endpoint expects an object.
clientToken
optional string

Client token for use in the Primer-JS SDK obtained via POST /client-session API call.

customerId
optional string

A unique identifier for your customer.

orderId
optional string

Your reference for the order.

currencyCode
optional string

The 3-letter currency code in ISO 4217 format. e.g. use USD for US dollars.

amount
optional integer

The amount you would like to charge the customer, in minor units. e.g. for $7, use 700.

Some currencies, such as Japanese Yen, do not have minor units. In this case you should use the value as it is, without any formatting. For example for ¥100, use 100.

If the amount is provided on this level, it would override any amount calculated from the provided line items, shipping and other amounts.

metadata
optional map from strings to any

Additional data to be used throughout the payment lifecycle.

Provide the entire object to update it. Anything provided previously will be overwritten.

customer
optional object

More information associated with the customer.

Each of the fields in this object must be updated in its entirety, i.e. provide the entire object to update it. Anything provided previously will be overwritten.

order
optional object

More information associated with the order.

Each of the fields in this object must be updated in its entirety, i.e. provide the entire object to update it. Anything provided previously will be overwritten.

paymentMethod
optional object

Enable certain options associated with the payment method. Provide the entire object to update it. Anything provided previously will be overwritten.

Response

This endpoint return an object.
customerId
optional string

A unique identifier for your customer.

orderId
optional string

Your reference for the payment.

currencyCode
optional enum

The 3-letter currency code in ISO 4217 format. e.g. use USD for US dollars.

amount
optional integer

The amount you are going to charge the customer, in minor units. This amount is calculated from the line items, shipping and other amounts provided in the order. If a top-level amount is provided, it would override any calculated amount.

metadata
optional map from strings to any

Additional data to be used throughout the payment lifecycle.

customer
optional object

More information associated with the customer.

order
optional object

More information associated with the order.

paymentMethod
optional object

Enable certain options associated with the payment methods.

Errors

PATCH
/client-session
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
curl -X PATCH "https://api.sandbox.primer.io/client-session" \
     -H "X-API-KEY: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "customer": {
    "billingAddress": {
      "countryCode": "AW"
    },
    "shippingAddress": {
      "countryCode": "AW"
    }
  },
  "order": {
    "countryCode": "AW",
    "retailerCountryCode": "AW"
  },
  "paymentMethod": {
    "paymentType": "FIRST_PAYMENT",
    "options": {
      "<PAYMENT_METHOD_TYPE>": {
        "surcharge": {}
      }
    },
    "authorizationType": "ESTIMATED"
  }
}'
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
  "currencyCode": "AED",
  "customer": {
    "billingAddress": {
      "countryCode": "AW"
    },
    "shippingAddress": {
      "countryCode": "AW"
    }
  },
  "order": {
    "countryCode": "AW",
    "retailerCountryCode": "AW"
  },
  "paymentMethod": {
    "paymentType": "FIRST_PAYMENT",
    "options": {
      "<PAYMENT_METHOD_TYPE>": {
        "surcharge": {}
      }
    },
    "authorizationType": "ESTIMATED"
  }
}