# Payments

## POST /v1/om/payments

> Creates a payment for the specified order.

```json
{"openapi":"3.0.0","info":{"title":"Gormic Order Management & POS API","version":"1.0"},"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"type":"apiKey","in":"header","name":"api-key","description":"API Key"}},"schemas":{"CreatePaymentApiRequest":{"type":"object","properties":{"params":{"$ref":"#/components/schemas/CreatePayment_Params"}},"required":["params"]},"CreatePayment_Params":{"type":"object","properties":{"orderId":{"type":"string"},"type":{"type":"string","enum":["receipt","refund"]},"custom":{"type":"boolean"},"amount":{"type":"number"},"methodId":{"type":"string"},"customerUid":{"type":"string"},"status":{"type":"string","enum":["complete","pending","progress","reversed"]},"sourcePaymentId":{"type":"string","nullable":true},"transactionRef":{"type":"string","nullable":true},"attrs":{"type":"object"},"invoiceId":{"type":"string"},"note":{"type":"string","nullable":true}},"required":["orderId","type"]},"CreatePaymentApiResponse":{"type":"object","properties":{"app":{"type":"string"},"service":{"type":"string"},"warnings":{"type":"array","items":{"type":"object"}},"instanceId":{"type":"string"},"requestId":{"type":"string"},"data":{"$ref":"#/components/schemas/CreatePayment_Data"}},"required":["app","service","warnings","instanceId","requestId","data"]},"CreatePayment_Data":{"type":"object","properties":{"id":{"type":"string"}},"required":["id"]},"CreatePaymentApiError":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/CreatePayment_Error"}},"required":["error"]},"CreatePayment_Error":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/CreatePayment_ErrorCodes_enum"}]}},"required":["code"]},"CreatePayment_ErrorCodes_enum":{"type":"string","enum":["INVALID_STATUS","INVOICE_CLOSED","INVOICE_NOT_FOUND","InvalidParameter","LIMIT_REACHED","MethodNotFound","ORDER_CANCELED","ORDER_CLOSED"]}}},"paths":{"/v1/om/payments":{"post":{"description":"","operationId":"Payments_create","parameters":[{"name":"organization-id","in":"header","required":true,"schema":{"type":"string"},"description":"Organization ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentApiRequest"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentApiResponse"}}}},"400":{"description":"Functional Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentApiError"}}}}},"summary":"Creates a payment for the specified order.","tags":["Payments"]}}}}
```

## DELETE /v1/om/payments/{uid}

> Deletes a payment.

```json
{"openapi":"3.0.0","info":{"title":"Gormic Order Management & POS API","version":"1.0"},"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"type":"apiKey","in":"header","name":"api-key","description":"API Key"}},"schemas":{"DeletePaymentApiResponse":{"type":"object","properties":{"app":{"type":"string"},"service":{"type":"string"},"warnings":{"type":"array","items":{"type":"object"}},"instanceId":{"type":"string"},"requestId":{"type":"string"},"data":{"$ref":"#/components/schemas/DeletePayment_Data"}},"required":["app","service","warnings","instanceId","requestId","data"]},"DeletePayment_Data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PaymentM"}},"paymentMethods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethodMap"}}},"required":["items","paymentMethods"]},"PaymentM":{"type":"object","properties":{"type":{"type":"string","enum":["receipt","refund"]},"status":{"type":"string","enum":["complete","pending","progress","reversed"]},"completedAt":{"type":"string"},"reversedAt":{"type":"string"},"custom":{"type":"boolean"},"amount":{"type":"number"},"sourcePaymentId":{"type":"string","nullable":true},"transactionRef":{"type":"string","nullable":true},"attrs":{"type":"object"},"invoiceId":{"type":"string"},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"},"createdVia":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedVia":{"type":"string"},"updatedBy":{"type":"string"},"id":{"type":"string"},"can":{"type":"array","items":{"type":"string","enum":["confirm","delete","edit","pay","print","refund"]}},"methodUid":{"type":"string"}},"required":["type","status","custom","amount","invoiceId","id","can"]},"PaymentMethodMap":{"type":"object","properties":{"locales":{"$ref":"#/components/schemas/__type_174bf132"},"visible":{"type":"boolean"},"createdAt":{"type":"string"},"createdVia":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedVia":{"type":"string"},"updatedBy":{"type":"string"},"id":{"type":"string"}},"required":["locales","visible","id"]},"__type_174bf132":{"type":"object","properties":{"ar":{"$ref":"#/components/schemas/__type_174bf132_Ar"},"en":{"$ref":"#/components/schemas/__type_174bf132_En"}},"required":["ar","en"]},"__type_174bf132_Ar":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["name"]},"__type_174bf132_En":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["name"]},"DeletePaymentApiError":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/DeletePayment_Error"}},"required":["error"]},"DeletePayment_Error":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/DeletePayment_ErrorCodes_enum"}]}},"required":["code"]},"DeletePayment_ErrorCodes_enum":{"type":"string","enum":["INVOICE_CLOSED","INVOICE_NOT_FOUND","NotFound","ORDER_CANCELED","ORDER_CLOSED","PAYMENT_COMPLETED","PAYMENT_IN_PROGRESS"]}}},"paths":{"/v1/om/payments/{uid}":{"delete":{"description":"","operationId":"Payments_delete","parameters":[{"name":"uid","required":true,"in":"path","schema":{"type":"string"}},{"name":"organization-id","in":"header","required":true,"schema":{"type":"string"},"description":"Organization ID"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletePaymentApiResponse"}}}},"400":{"description":"Functional Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeletePaymentApiError"}}}}},"summary":"Deletes a payment.","tags":["Payments"]}}}}
```

## PATCH /v1/om/payments/{uid}

> Updates a payament.

```json
{"openapi":"3.0.0","info":{"title":"Gormic Order Management & POS API","version":"1.0"},"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"type":"apiKey","in":"header","name":"api-key","description":"API Key"}},"schemas":{"UpdatePaymentApiRequest":{"type":"object","properties":{"params":{"$ref":"#/components/schemas/UpdatePayment_Params"}},"required":["params"]},"UpdatePayment_Params":{"type":"object","properties":{"id":{"type":"string"},"orderId":{"type":"string"},"amount":{"type":"number"},"methodId":{"type":"string"},"custom":{"type":"boolean"},"correction":{"type":"boolean"},"customerUid":{"type":"string"},"status":{"type":"string","enum":["complete","pending","progress","reversed"]},"sourcePaymentId":{"type":"string","nullable":true},"transactionRef":{"type":"string","nullable":true},"attrs":{"type":"object"},"note":{"type":"string","nullable":true}},"required":["id","orderId"]},"UpdatePaymentApiResponse":{"type":"object","properties":{"app":{"type":"string"},"service":{"type":"string"},"warnings":{"type":"array","items":{"type":"object"}},"instanceId":{"type":"string"},"requestId":{"type":"string"},"data":{"$ref":"#/components/schemas/UpdatePayment_Data"}},"required":["app","service","warnings","instanceId","requestId","data"]},"UpdatePayment_Data":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"]},"UpdatePaymentApiError":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/UpdatePayment_Error"}},"required":["error"]},"UpdatePayment_Error":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/UpdatePayment_ErrorCodes_enum"}]}},"required":["code"]},"UpdatePayment_ErrorCodes_enum":{"type":"string","enum":["CHANGE_STATUS_NOT_ALLOWED","INVALID_STATUS","INVOICE_CLOSED","INVOICE_NOT_FOUND","InvalidParameter","LIMIT_REACHED","MethodNotFound","NoChanges","NotFound","ORDER_CANCELED","ORDER_CLOSED","PAYMENT_COMPLETED"]}}},"paths":{"/v1/om/payments/{uid}":{"patch":{"description":"","operationId":"Payments_001_update","parameters":[{"name":"uid","required":true,"in":"path","schema":{"type":"string"}},{"name":"organization-id","in":"header","required":true,"schema":{"type":"string"},"description":"Organization ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentApiRequest"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentApiResponse"}}}},"400":{"description":"Functional Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePaymentApiError"}}}}},"summary":"Updates a payament.","tags":["Payments"]}}}}
```

## PATCH /v1/om/payments/{uid}/confirm

> Marks a payment as completed.

```json
{"openapi":"3.0.0","info":{"title":"Gormic Order Management & POS API","version":"1.0"},"security":[{"api-key":[]}],"components":{"securitySchemes":{"api-key":{"type":"apiKey","in":"header","name":"api-key","description":"API Key"}},"schemas":{"ConfirmPaymentApiRequest":{"type":"object","properties":{"params":{"$ref":"#/components/schemas/ConfirmPayment_Params"}},"required":["params"]},"ConfirmPayment_Params":{"type":"object","properties":{"id":{"type":"string"},"orderId":{"type":"string"},"customerUid":{"type":"string"},"transactionRef":{"type":"string","nullable":true},"attrs":{"type":"object"}},"required":["id","orderId"]},"ConfirmPaymentApiResponse":{"type":"object","properties":{"app":{"type":"string"},"service":{"type":"string"},"warnings":{"type":"array","items":{"type":"object"}},"instanceId":{"type":"string"},"requestId":{"type":"string"},"data":{"$ref":"#/components/schemas/ConfirmPayment_Data"}},"required":["app","service","warnings","instanceId","requestId","data"]},"ConfirmPayment_Data":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/PaymentM"}},"paymentMethods":{"type":"array","items":{"$ref":"#/components/schemas/PaymentMethodMap"}}},"required":["items","paymentMethods"]},"PaymentM":{"type":"object","properties":{"type":{"type":"string","enum":["receipt","refund"]},"status":{"type":"string","enum":["complete","pending","progress","reversed"]},"completedAt":{"type":"string"},"reversedAt":{"type":"string"},"custom":{"type":"boolean"},"amount":{"type":"number"},"sourcePaymentId":{"type":"string","nullable":true},"transactionRef":{"type":"string","nullable":true},"attrs":{"type":"object"},"invoiceId":{"type":"string"},"note":{"type":"string","nullable":true},"createdAt":{"type":"string"},"createdVia":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedVia":{"type":"string"},"updatedBy":{"type":"string"},"id":{"type":"string"},"can":{"type":"array","items":{"type":"string","enum":["confirm","delete","edit","pay","print","refund"]}},"methodUid":{"type":"string"}},"required":["type","status","custom","amount","invoiceId","id","can"]},"PaymentMethodMap":{"type":"object","properties":{"locales":{"$ref":"#/components/schemas/__type_174bf132"},"visible":{"type":"boolean"},"createdAt":{"type":"string"},"createdVia":{"type":"string"},"createdBy":{"type":"string"},"updatedAt":{"type":"string"},"updatedVia":{"type":"string"},"updatedBy":{"type":"string"},"id":{"type":"string"}},"required":["locales","visible","id"]},"__type_174bf132":{"type":"object","properties":{"ar":{"$ref":"#/components/schemas/__type_174bf132_Ar"},"en":{"$ref":"#/components/schemas/__type_174bf132_En"}},"required":["ar","en"]},"__type_174bf132_Ar":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["name"]},"__type_174bf132_En":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string","nullable":true}},"required":["name"]},"ConfirmPaymentApiError":{"type":"object","properties":{"error":{"$ref":"#/components/schemas/ConfirmPayment_Error"}},"required":["error"]},"ConfirmPayment_Error":{"type":"object","properties":{"code":{"allOf":[{"$ref":"#/components/schemas/ConfirmPayment_ErrorCodes_enum"}]}},"required":["code"]},"ConfirmPayment_ErrorCodes_enum":{"type":"string","enum":["INVALID_OPERATION","METHOD_NOT_SELECTED","MethodNotFound","NO_PERMISSION","NoChanges","NotFound","ORDER_CANCELED","ORDER_CLOSED"]}}},"paths":{"/v1/om/payments/{uid}/confirm":{"patch":{"operationId":"Payments_confirm","parameters":[{"name":"uid","required":true,"in":"path","schema":{"type":"string"}},{"name":"organization-id","in":"header","required":true,"schema":{"type":"string"},"description":"Organization ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmPaymentApiRequest"}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmPaymentApiResponse"}}}},"400":{"description":"Functional Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmPaymentApiError"}}}}},"summary":"Marks a payment as completed.","tags":["Payments"]}}}}
```
