Representations
MyPayment
id ​String​ | Unique identifier of the Payment. |
version ​Int​ | Current version of the Payment. |
customer ​ | Reference to a Customer associated with the Payment. Set automatically with a password flow token. Either customer or anonymousId is present. |
anonymousId ​String​ | Anonymous session associated with the Payment. Set automatically with a token for an anonymous session. Either customer or anonymousId is present. |
amountPlanned ​ | |
paymentMethodInfo ​ | Information regarding the payment interface (for example, a PSP), and the specific payment method used. |
transactions ​Array of Transaction​ | Financial transactions of the Payment. Each Transaction has a TransactionType and a TransactionState. |
custom ​CustomFields​ | Custom Fields defined for the Payment. |
MyPaymentDraft
amountPlanned ​Money​ | |
paymentMethodInfo ​ | Information regarding the payment interface (for example, a PSP), and the specific payment method used. |
transaction ​ | |
custom ​ | Custom Fields for the Payment. |
MyPaymentPagedQueryResponse
limit ​Int​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
count ​Int​ | Actual number of results returned. |
total ​Int​ | Total number of results matching the query.
This number is an estimation that is not strongly consistent.
This field is returned by default.
For improved performance, calculating this field can be deactivated by using the query parameter withTotal=false .
When the results are filtered with a Query Predicate, total is subject to a limit. |
offset ​Int​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
results ​Array of MyPayment​ | MyPayments matching the query. |
MyTransactionDraft
timestamp ​DateTime​ | Date and time (UTC) the Transaction took place. |
type ​ | Type of the Transaction.
Only Authorization or Charge is allowed. |
amount ​Money​ | Money value for the Transaction. |
interactionId ​String​ | Identifier used by the payment service that manages the Transaction. Can be used to correlate the Transaction to an interface interaction. |
custom ​ | Custom Fields of the Transaction. |
Get MyPayment
id
for the authenticated Customer or anonymous user.manage_my_payments:{projectKey}
customer_id:{id}
anonymous_id:{id}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the MyPayment. |
expand | The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/me/payments/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "776f9240-09e1-4416-a34f-32fa80f0333f",
"version": 1,
"amountPlanned": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"customer": {
"typeId": "customer",
"id": "2c0b6ab8-5eea-4e19-b815-d150c47da5db"
},
"paymentMethodInfo": {
"paymentInterface": "STRIPE",
"method": "CREDIT_CARD",
"name": {
"en": "Credit Card"
}
},
"transactions": [
{
"id": "14748fe6-7f77-456a-96c8-913b1e4bbc9a",
"timestamp": "2015-10-20T08:54:24.000Z",
"type": "Charge",
"amount": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"state": "Pending"
}
]
}
Query MyPayments
manage_my_payments:{projectKey}
customer_id:{id}
anonymous_id:{id}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
where | The parameter can be passed multiple times. |
sort | The parameter can be passed multiple times. |
expand | The parameter can be passed multiple times. |
limit Int ​ | Number of results requested. Default: 20 ​Minimum: 0 ​Maximum: 500 ​ |
offset Int ​ | Number of elements skipped. Default: 0 ​Maximum: 10000 ​ |
withTotal Boolean ​ | Controls the calculation of the total number of query results. Set to false to improve query performance when the total is not needed.Default: true ​ |
var.<varName> String ​ | Predicate parameter values. The parameter can be passed multiple times. |
application/json
curl --get https://api.{region}.commercetools.com/{projectKey}/me/payments -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"limit": 20,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"id": "459e32dc-74ef-4189-bbd0-932275bb027c",
"version": 1,
"amountPlanned": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"customer": {
"typeId": "customer",
"id": "2c0b6ab8-5eea-4e19-b815-d150c47da5db"
},
"paymentMethodInfo": {
"paymentInterface": "STRIPE",
"method": "CREDIT_CARD",
"name": {
"en": "Credit Card"
}
},
"transactions": [
{
"id": "2e318aa5-8af4-4db1-909d-e7142f7d174f",
"timestamp": "2015-10-20T08:51:56.000Z",
"type": "Charge",
"amount": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"state": "Pending"
}
]
}
]
}
Check if MyPayment exists
Check if MyPayment exists by ID
manage_my_payments:{projectKey}
customer_id:{id}
anonymous_id:{id}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the MyPayment. |
curl --head https://api.{region}.commercetools.com/{projectKey}/me/payments/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Check if MyPayment exists by Query Predicate
manage_my_payments:{projectKey}
customer_id:{id}
anonymous_id:{id}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
where | The parameter can be passed multiple times. |
curl --head https://api.{region}.commercetools.com/{projectKey}/me/payments -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
Create MyPayment
manage_my_payments:{projectKey}
customer_id:{id}
anonymous_id:{id}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
expand | The parameter can be passed multiple times. |
application/json
application/json
curl https://api.{region}.commercetools.com/{projectKey}/me/payments -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"amountPlanned" : {
"currencyCode" : "USD",
"centAmount" : 1000
},
"paymentMethodInfo" : {
"paymentInterface" : "STRIPE",
"method" : "CREDIT_CARD",
"name" : {
"en" : "Credit Card"
}
},
"transaction" : {
"timestamp" : "2015-10-20T08:54:24.000Z",
"type" : "Charge",
"amount" : {
"currencyCode" : "USD",
"centAmount" : 1000
}
}
}
DATA
{
"id": "776f9240-09e1-4416-a34f-32fa80f0333f",
"version": 1,
"amountPlanned": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"customer": {
"typeId": "customer",
"id": "2c0b6ab8-5eea-4e19-b815-d150c47da5db"
},
"paymentMethodInfo": {
"paymentInterface": "STRIPE",
"method": "CREDIT_CARD",
"name": {
"en": "Credit Card"
}
},
"transactions": [
{
"id": "14748fe6-7f77-456a-96c8-913b1e4bbc9a",
"timestamp": "2015-10-20T08:54:24.000Z",
"type": "Charge",
"amount": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"state": "Pending"
}
]
}
Update MyPayment
manage_my_payments:{projectKey}
customer_id:{id}
anonymous_id:{id}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the MyPayment. |
expand | The parameter can be passed multiple times. |
application/json
version ​Int​ | Expected version of the Payment on which the changes should be applied.
If the expected version does not match the actual version, a ConcurrentModification error will be returned. |
actions ​Array of MyPaymentUpdateAction​ | Update actions to be performed on the Payment. |
application/json
curl https://api.{region}.commercetools.com/{projectKey}/me/payments/{id} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"version" : 1,
"actions" : [ {
"action" : "changeAmountPlanned",
"amount" : {
"currencyCode" : "USD",
"centAmount" : 1000
}
} ]
}
DATA
{
"id": "776f9240-09e1-4416-a34f-32fa80f0333f",
"version": 1,
"amountPlanned": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"customer": {
"typeId": "customer",
"id": "2c0b6ab8-5eea-4e19-b815-d150c47da5db"
},
"paymentMethodInfo": {
"paymentInterface": "STRIPE",
"method": "CREDIT_CARD",
"name": {
"en": "Credit Card"
}
},
"transactions": [
{
"id": "14748fe6-7f77-456a-96c8-913b1e4bbc9a",
"timestamp": "2015-10-20T08:54:24.000Z",
"type": "Charge",
"amount": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"state": "Pending"
}
]
}
Update actions
Set MethodInfoInterface
action ​String​ | "setMethodInfoInterface" |
interface ​String​ | Value to set.
Once set, the paymentInterface of the paymentMethodInfo cannot be changed. |
{
"action": "setMethodInfoInterface",
"interface": "MethodInfoInterfaceString"
}
Set MethodInfoMethod
action ​String​ | "setMethodInfoMethod" |
method ​String​ | Value to set. If empty, any existing value will be removed. |
{
"action": "setMethodInfoMethod",
"method": "MethodInfoMethodString"
}
Set MethodInfoName
action ​String​ | "setMethodInfoName" |
name ​ | Value to set. If empty, any existing value will be removed. |
{
"action": "setMethodInfoName",
"name": {
"de": "MethodInfoNameStringDE",
"en": "MethodInfoNameStringEN"
}
}
Add Transaction
action ​String​ | "addTransaction" |
transaction ​ | Transaction to add to the Payment. |
{
"action": "addTransaction",
"transaction": {
"type": "Authorization",
"amount": {
"centAmount": 4000,
"currencyCode": "EUR"
}
}
}
Set CustomField
action ​String​ | "setCustomField" |
name ​String​ | Name of the Custom Field. |
value ​ | If value is absent or null , this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name . |
{
"action": "setCustomField",
"name": "exampleStringField",
"value": "TextString"
}
Set Transaction CustomField
action ​String​ | "setTransactionCustomField" |
name ​String​ | Name of the Custom Field. |
value ​ | If value is absent or null , this field will be removed if it exists.
Removing a field that does not exist returns an InvalidOperation error.
If value is provided, it is set for the field defined by name . |
{
"action": "setTransactionCustomField",
"name": "exampleStringField",
"value": "TextString"
}
Change AmountPlanned
action ​String​ | "changeAmountPlanned" |
amount ​Money​ | New value to set. |
{
"action": "changeAmountPlanned",
"amount": {
"currencyCode": "EUR",
"centAmount": 4000
}
}
Delete MyPayment
id
for the authenticated Customer or anonymous user.
You can only delete a Payment if it has no Transactions.manage_my_payments:{projectKey}
customer_id:{id}
anonymous_id:{id}
region String ​ | Region in which the Project is hosted. |
projectKey String ​ | key of the Project. |
id String ​ | id of the MyPayment. |
version Int ​ | Last seen version of the resource. |
expand | The parameter can be passed multiple times. |
application/json
curl -X DELETE https://api.{region}.commercetools.com/{projectKey}/me/payments/{id}?version={version} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}"
{
"id": "776f9240-09e1-4416-a34f-32fa80f0333f",
"version": 1,
"amountPlanned": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"customer": {
"typeId": "customer",
"id": "2c0b6ab8-5eea-4e19-b815-d150c47da5db"
},
"paymentMethodInfo": {
"paymentInterface": "STRIPE",
"method": "CREDIT_CARD",
"name": {
"en": "Credit Card"
}
},
"transactions": [
{
"id": "14748fe6-7f77-456a-96c8-913b1e4bbc9a",
"timestamp": "2015-10-20T08:54:24.000Z",
"type": "Charge",
"amount": {
"type": "centPrecision",
"fractionDigits": 2,
"currencyCode": "USD",
"centAmount": 1000
},
"state": "Pending"
}
]
}