Przejdź do głównej zawartości

createOrderPayment

Dla: Programista

MutacjaBetaMutation.createOrderPayment

Records a payment received for an order, in the order currency. Does not change Order.paymentStatus: set it with updateOrder when the order is paid. Refused for an archived order.

Wymagany zakresorders:write
Dostępne odPrynt 0.28.0
StabilnośćBeta (co to znaczy)
PonawianieWysyłaj nagłówek Idempotency-Key, żeby ponowienie nie wykonało zapisu drugi raz. Zapisy i idempotencja

Argumenty

NazwaTypOpis
inputwymaganeCreateOrderPaymentInput!

The payment and the order it is for.

Zwraca

OrderPayment!

Przykład

Mutacja
mutation RecordPayment($input: CreateOrderPaymentInput!) {
createOrderPayment(input: $input) {
id
orderId
method
reference
paidAt
}
}
Zmienne
{
"input": {
"orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"amount": 553.5,
"method": "ONLINE_PREPAID",
"reference": "P24-2026-10-05-77812",
"paidAt": "2026-10-05T09:38:00Z"
}
}
Wywołanie (curl)
IDEMPOTENCY_KEY=$(uuidgen) # ponawiaj z tym samym kluczem
curl -sS https://twoja-drukarnia.prynt.pl/api/v1/graphql \
-H "Authorization: Bearer $PRYNT_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $IDEMPOTENCY_KEY" \
--data-binary @- <<'JSON'
{
"query": "mutation RecordPayment($input: CreateOrderPaymentInput!) {\n createOrderPayment(input: $input) {\n id\n orderId\n method\n reference\n paidAt\n }\n}",
"variables": {
"input": {
"orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"amount": 553.5,
"method": "ONLINE_PREPAID",
"reference": "P24-2026-10-05-77812",
"paidAt": "2026-10-05T09:38:00Z"
}
}
}
JSON
Odpowiedź
{
"data": {
"createOrderPayment": {
"id": "cf6b82a3-5e70-4b92-8dbe-3f4a5b6c7d85",
"orderId": "4b0d2a63-8e5f-4c9b-8f32-6d7e8f9a0b12",
"method": "ONLINE_PREPAID",
"reference": "P24-2026-10-05-77812",
"paidAt": "2026-10-05T09:38:00.000Z"
}
}
}