# Payment   frontend

## Initializing a payment

> Initializes a payment by accepting a request sent from the frontend.\
> No scope is required.<br>

```json
{"openapi":"3.0.0","info":{"title":"Payment-Gateway Service","version":"0.0.1"},"tags":[{"name":"Payment - frontend"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":[]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"payment-gateway.paymentmodes_read":"Needed for reading payment modes by a tenant employee.","payment-gateway.paymentmodes_manage":"Needed to manage payment modes by a tenant employee.","payment-gateway.authorize_manage":"Needed to perform a payment authorization flow by a tenant employee.","payment-gateway.capture_manage":"Needed to perform a payment capture flow by a tenant employee.","payment-gateway.refund_manage":"Needed to perform a payment refund flow by a tenant employee.","payment-gateway.cancel_manage":"Needed to perform a payment cancel flow by a tenant employee.","payment-gateway.paymenttransactions_read":"Needed to read all transaction details by a tenant employee."}}}}},"responses":{"paymentInitializeResponse":{"description":"Payment initialized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/initializePaymentResponse"}}}},"common_response_BadRequest_400":{"description":"Bad request. The syntax of the request is incorrect.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}},"common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"common_response_Unprocessable_Entity_422":{"description":"Unprocessable Entity. The payment action is not supported.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}},"common_response_InternalServerError_500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}}},"schemas":{"initializePaymentResponse":{"title":"initializePaymentResponse","type":"object","properties":{"successful":{"type":"boolean","description":"Indicates if the authorization process finished with success."},"paymentTransactionId":{"type":"string","description":"Unique payment transaction identifier. "},"authorizationToken":{"type":"string","description":"Authorization token"},"externalPaymentRedirectURL":{"type":"string","description":"Indicates a URL address where a user should be redirected in order to finish the authorization process."},"externalPaymentHttpMethod":{"type":"string","description":"Indicates a HTTP Method which should be used in order to finish the authorization process."},"externalPaymentParameters":{"type":"object","additionalProperties":{"type":"string"},"description":"Map of additional parameters that may be needed in order to complete the authorization flow. "}}},"coreErrorMessage":{"anyOf":[{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status code."},"timestamp":{"type":"string","description":"Indicates a timestamp when the error occurred."},"message":{"type":"string","description":"Error message."}}},{"type":"object","properties":{"type":{"type":"string","description":"HTTP error type."},"status":{"type":"integer","description":"HTTP Status code."},"message":{"type":"string","description":"Error message."},"moreInfo":{"type":"string","description":"URL which additional information."},"details":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"Detailed message."}}}}}}]},"initializePaymentRequest":{"title":"initializePaymentRequest","type":"object","properties":{"order":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of an order for which the payment should be authorized."}}},"paymentModeId":{"type":"string","description":"Identifier of a payment mode configured in the payment-gateway service for a given tenant."},"creditCardToken":{"type":"string","description":"Indicates a payment method token, usually generated on a frontend site, when an user provides a credit card information."}}}}},"paths":{"/payment-gateway/{tenant}/payment/frontend/initialize":{"post":{"summary":"Initializing a payment","operationId":"POST-payment-gateway-initialize-payment-frontend","responses":{"200":{"$ref":"#/components/responses/paymentInitializeResponse"},"400":{"$ref":"#/components/responses/common_response_BadRequest_400"},"401":{"$ref":"#/components/responses/common_response_Unauthorized_401"},"422":{"$ref":"#/components/responses/common_response_Unprocessable_Entity_422"},"500":{"$ref":"#/components/responses/common_response_InternalServerError_500"}},"tags":["Payment - frontend"],"description":"Initializes a payment by accepting a request sent from the frontend.\nNo scope is required.\n","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/initializePaymentRequest"}}}}}}}}
```

## Authorizing a payment

> Authorize a payment by accepting a request sent from the frontend.\
> No scope is required.<br>

```json
{"openapi":"3.0.0","info":{"title":"Payment-Gateway Service","version":"0.0.1"},"tags":[{"name":"Payment - frontend"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"OAuth2":[]}],"components":{"securitySchemes":{"OAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"payment-gateway.paymentmodes_read":"Needed for reading payment modes by a tenant employee.","payment-gateway.paymentmodes_manage":"Needed to manage payment modes by a tenant employee.","payment-gateway.authorize_manage":"Needed to perform a payment authorization flow by a tenant employee.","payment-gateway.capture_manage":"Needed to perform a payment capture flow by a tenant employee.","payment-gateway.refund_manage":"Needed to perform a payment refund flow by a tenant employee.","payment-gateway.cancel_manage":"Needed to perform a payment cancel flow by a tenant employee.","payment-gateway.paymenttransactions_read":"Needed to read all transaction details by a tenant employee."}}}}},"responses":{"paymentAuthorizeResponse":{"description":"Payment authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/authorizePaymentResponse"}}}},"common_response_BadRequest_400":{"description":"Bad request. The syntax of the request is incorrect.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}},"common_response_Unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"common_response_Unprocessable_Entity_422":{"description":"Unprocessable Entity. The payment action is not supported.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}},"common_response_InternalServerError_500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/coreErrorMessage"}}}}},"schemas":{"authorizePaymentResponse":{"title":"authorizePaymentResponse","allOf":[{"$ref":"#/components/schemas/initializePaymentResponse"},{"type":"object","properties":{"requiresExternalPayment":{"type":"boolean","description":"Indicates if a redirect to an external site is required in order to finish the authorization flow."}}}]},"initializePaymentResponse":{"title":"initializePaymentResponse","type":"object","properties":{"successful":{"type":"boolean","description":"Indicates if the authorization process finished with success."},"paymentTransactionId":{"type":"string","description":"Unique payment transaction identifier. "},"authorizationToken":{"type":"string","description":"Authorization token"},"externalPaymentRedirectURL":{"type":"string","description":"Indicates a URL address where a user should be redirected in order to finish the authorization process."},"externalPaymentHttpMethod":{"type":"string","description":"Indicates a HTTP Method which should be used in order to finish the authorization process."},"externalPaymentParameters":{"type":"object","additionalProperties":{"type":"string"},"description":"Map of additional parameters that may be needed in order to complete the authorization flow. "}}},"coreErrorMessage":{"anyOf":[{"type":"object","properties":{"code":{"type":"integer","description":"HTTP Status code."},"timestamp":{"type":"string","description":"Indicates a timestamp when the error occurred."},"message":{"type":"string","description":"Error message."}}},{"type":"object","properties":{"type":{"type":"string","description":"HTTP error type."},"status":{"type":"integer","description":"HTTP Status code."},"message":{"type":"string","description":"Error message."},"moreInfo":{"type":"string","description":"URL which additional information."},"details":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string","description":"Detailed message."}}}}}}]},"authorizeFrontendPaymentRequest":{"title":"authorizeFrontendPaymentRequest","allOf":[{"$ref":"#/components/schemas/initializePaymentRequest"},{"type":"object","properties":{"threeDSToken":{"type":"string","description":"Contains a token generated during the 3DS authentication process."},"browserInfo":{"type":"string","description":"Holds information related to the user's web browser."},"clientIP":{"type":"string","description":"Stores the IP address of the client or user making the request."}}}]},"initializePaymentRequest":{"title":"initializePaymentRequest","type":"object","properties":{"order":{"type":"object","properties":{"id":{"type":"string","description":"Identifier of an order for which the payment should be authorized."}}},"paymentModeId":{"type":"string","description":"Identifier of a payment mode configured in the payment-gateway service for a given tenant."},"creditCardToken":{"type":"string","description":"Indicates a payment method token, usually generated on a frontend site, when an user provides a credit card information."}}}}},"paths":{"/payment-gateway/{tenant}/payment/frontend/authorize":{"post":{"summary":"Authorizing a payment","operationId":"POST-payment-gateway-authorize-payment-frontend","responses":{"200":{"$ref":"#/components/responses/paymentAuthorizeResponse"},"400":{"$ref":"#/components/responses/common_response_BadRequest_400"},"401":{"$ref":"#/components/responses/common_response_Unauthorized_401"},"422":{"$ref":"#/components/responses/common_response_Unprocessable_Entity_422"},"500":{"$ref":"#/components/responses/common_response_InternalServerError_500"}},"tags":["Payment - frontend"],"description":"Authorize a payment by accepting a request sent from the frontend.\nNo scope is required.\n","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/authorizeFrontendPaymentRequest"}}}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.emporix.io/api-references-1/readme/api-reference-24/payment-frontend.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
