Observability API (Beta)

Update an external payment

PATCH

The Observability API is currently in beta.

Please contact our Support Team via our JIRA Service Desk for access to the Beta. If you don’t have access, please contact your account administrator for assistance.

Not yet integrated with Primer and interested in learning more? Contact us.

You can update payments created earlier through the Observability API with this endpoint. The only required field for the request is paymentId. Other supported request fields are the same as for the create an external payment API call.

If you wish to update nested fields on the payment, you only need to pass the fields that you wish to update. For example to update the processor name, you would pass in processor.name only.

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

Path parameters

paymentIdstringRequired

Request

This endpoint expects an object.
paymentId
stringOptional

The payment ID.

The payment ID must be unique. You can use this unique payment ID to update payment details.

currencyCode
enumOptional

The 3-letter currency code in ISO 4217 format.

e.g. use USD for US dollars.

processor
objectOptional
amount
integerOptional

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. The minimum amount is 0.

createdAt
datetimeOptional

The payment creation date and time (UTC) in ISO 8601 format.

Cannot be updated in partial updates PATCH.

order
objectOptional
status
enumOptional
statusReason
objectOptional

Pass more information regarding the payment’s status in this field.

This is especially useful when the status is DECLINED or FAILED.

paymentMethod
objectOptional
metadata
map from strings to anyOptional

Additional data to be used throughout the payment lifecycle.

Ad dictionary of key-value pairs where the values can only be strings or integers.

e.g. {"productId": 1001, "merchantId": "88278a"}

paymentType
enumOptional

Payment types, primarily to be used for recurring payments.

Note: If you successfully vault a SINGLE_USE token on payment creation, then there’s no need to set a value for this field and it will be flagged as FIRST_PAYMENT. Otherwise, see the table below for all possible values.

paymentTypeUse case
FIRST_PAYMENTa customer-initiated payment which is the first in a series of recurring payments or subscription, or a card on file scenario.
ECOMMERCEa customer-initiated payment using stored payment details where the cardholder is present.
SUBSCRIPTIONa merchant-initiated payment as part of a series of payments on a fixed schedule and a set amount.
UNSCHEDULEDa merchant-initiated payment using stored payment details with no fixed schedule or amount.
MOTOa merchant-initiated mail order or telephone order payment.
IN_STOREa customer-initiated payment where the customer is physically present in a shop.
descriptor
stringOptional
A description of the payment, as it would typically appear on a bank statement.

Response

This endpoint returns an object
paymentId
string

The payment ID.

The payment ID must be unique. You can use this unique payment ID to update payment details.

currencyCode
enum

The 3-letter currency code in ISO 4217 format.

e.g. use USD for US dollars.

processor
object
amount
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. The minimum amount is 0.

createdAt
datetime

The payment creation date and time (UTC) in ISO 8601 format.

Cannot be updated in partial updates PATCH.

order
object
paymentMethod
object
status
enumOptional
statusReason
objectOptional

Pass more information regarding the payment’s status in this field.

This is especially useful when the status is DECLINED or FAILED.

metadata
map from strings to anyOptional

Additional data to be used throughout the payment lifecycle.

Ad dictionary of key-value pairs where the values can only be strings or integers.

e.g. {"productId": 1001, "merchantId": "88278a"}

paymentType
enumOptional

Payment types, primarily to be used for recurring payments.

Note: If you successfully vault a SINGLE_USE token on payment creation, then there’s no need to set a value for this field and it will be flagged as FIRST_PAYMENT. Otherwise, see the table below for all possible values.

paymentTypeUse case
FIRST_PAYMENTa customer-initiated payment which is the first in a series of recurring payments or subscription, or a card on file scenario.
ECOMMERCEa customer-initiated payment using stored payment details where the cardholder is present.
SUBSCRIPTIONa merchant-initiated payment as part of a series of payments on a fixed schedule and a set amount.
UNSCHEDULEDa merchant-initiated payment using stored payment details with no fixed schedule or amount.
MOTOa merchant-initiated mail order or telephone order payment.
IN_STOREa customer-initiated payment where the customer is physically present in a shop.
descriptor
stringOptional
A description of the payment, as it would typically appear on a bank statement.
PATCH
$curl -X PATCH https://api.sandbox.primer.io/observability/payments/string \
> -H "X-API-KEY: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "currencyCode": "AED",
> "processor": {
> "name": "APAYA"
> },
> "order": {
> "id": "string",
> "countryCode": "AW"
> },
> "status": "DECLINED",
> "statusReason": {
> "type": "APPLICATION_ERROR",
> "declineType": "SOFT_DECLINE",
> "code": "ERROR"
> },
> "paymentMethod": {
> "paymentMethodType": "PAYMENT_CARD",
> "data": {
> "binData": {
> "network": "AMEX",
> "issuerCountryCode": "AW"
> }
> },
> "threeDSecureAuthentication": {
> "responseCode": "NOT_PERFORMED"
> }
> },
> "paymentType": "FIRST_PAYMENT"
>}'
Response
1{
2 "paymentId": "string",
3 "currencyCode": "AED",
4 "processor": {
5 "name": "APAYA"
6 },
7 "amount": 1,
8 "createdAt": "2024-01-15T09:30:00Z",
9 "order": {
10 "id": "string",
11 "countryCode": "AW"
12 },
13 "paymentMethod": {
14 "paymentMethodType": "PAYMENT_CARD",
15 "data": {
16 "binData": {
17 "network": "AMEX",
18 "issuerCountryCode": "AW"
19 }
20 },
21 "threeDSecureAuthentication": {
22 "responseCode": "NOT_PERFORMED"
23 }
24 },
25 "status": "DECLINED",
26 "statusReason": {
27 "type": "APPLICATION_ERROR",
28 "declineType": "SOFT_DECLINE",
29 "code": "ERROR"
30 },
31 "paymentType": "FIRST_PAYMENT"
32}