Payment-Refund-v2: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (replaced reference to v2 GetPaymentState with v4 PaymentState) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 17: | Line 17: | ||
* [[Calling_the_API|Calling the Barion API]] | * [[Calling_the_API|Calling the Barion API]] | ||
* API: [[Payment-Start-v2 | /Payment/Start]] | * API: [[Payment-Start-v2 | /Payment/Start]] | ||
* API: [[Payment- | * API: [[Payment-PaymentState-v4 | /Payment/<PaymentId>/PaymentState]] | ||
<span class="api-ver">v2</span> This API endpoint is available in '''API v2''' only. | <span class="api-ver">v2</span> This API endpoint is available in '''API v2''' only. | ||
== Authentication == | |||
[[Barion Shop Authentication]] | |||
== Use cases == | == Use cases == | ||
Line 59: | Line 63: | ||
| RefundedTransactions || [[RefundedTransaction]][] || An array containing information about the refunded transactions. | | RefundedTransactions || [[RefundedTransaction]][] || An array containing information about the refunded transactions. | ||
|} | |||
== Possible error responses == | |||
{| class="wikitable api-table" | |||
! Error code || Description | |||
|- | |||
| ModelValidationError || This happens when some of the input properties fail the basic validation. For example a string property exceeds its allowed length. | |||
|- | |||
| NotExistingPaymentId || The specified payment id is invalid. | |||
|- | |||
| SuspendedUserTriedToRefund || You are not allowed to refund a payment if you are suspended. | |||
|- | |||
| TheSourceAndDestinationAccountsAreMatched || Very rare error, this happens in case the payment was payed by the shop owner. | |||
|- | |||
| PaymentStatusNotValid || Only payments in <code>Succeeded</code> [[PaymentStatus|status]] can be refunded. | |||
|- | |||
| TransactionDoesNotBelongToPayment || The transaction specified in the request body does not belong to a payment. | |||
|- | |||
| InvalidTransactionType || The transaction specified is not a refundable [[TransactionType|transaction type]]. Only <code>CardPayment</code>, <code>Shop</code> and <code>BankTransferPayment</code> types are refundable. | |||
|- | |||
| InvalidAccount || The account is not eligable for refund. | |||
|- | |||
| TooLowBalanceToMakeRefund || There is not enough funds to fulfill the refund request. | |||
|- | |||
| AmountToRefundIsGreaterThanTransactionAmount || The amount specified to refund is greater than the original payment transaction itself. | |||
|- | |||
| InternalServerError || Something unexpected happened. | |||
|- | |||
|} | |} |
Latest revision as of 10:09, 25 March 2024
Barion API: Execute the refund of a payment
POST | /v2/Payment/Refund |
---|
The /payment/refund
API endpoint is used to execute a refund of an existing, completed payment.
Prerequisites before use:
- Creating an account in Barion
- Creating a shop in Barion
- Calling the Barion API
- API: /Payment/Start
- API: /Payment/<PaymentId>/PaymentState
v2 This API endpoint is available in API v2 only.
Authentication
Use cases
This API endpoint is designed to be used in the following scenarios:
Input properties
Property name | Property type | Limitations and constraints | Description |
---|---|---|---|
POSKey | Guid |
|
The secret API key of the shop, generated by Barion. This lets the shop to authenticate through the Barion API, but does not provide access to the account owning the shop itself. |
PaymentId | Guid |
|
The identifier of the payment in the Barion system. |
TransactionsToRefund | TransactionToRefund[] |
|
An array containing the payment transactions to refund. |
Output properties
Property name | Property type | Description |
---|---|---|
PaymentId | Guid | The identifier of the payment in the Barion system. |
RefundedTransactions | RefundedTransaction[] | An array containing information about the refunded transactions. |
Possible error responses
Error code | Description |
---|---|
ModelValidationError | This happens when some of the input properties fail the basic validation. For example a string property exceeds its allowed length. |
NotExistingPaymentId | The specified payment id is invalid. |
SuspendedUserTriedToRefund | You are not allowed to refund a payment if you are suspended. |
TheSourceAndDestinationAccountsAreMatched | Very rare error, this happens in case the payment was payed by the shop owner. |
PaymentStatusNotValid | Only payments in Succeeded status can be refunded.
|
TransactionDoesNotBelongToPayment | The transaction specified in the request body does not belong to a payment. |
InvalidTransactionType | The transaction specified is not a refundable transaction type. Only CardPayment , Shop and BankTransferPayment types are refundable.
|
InvalidAccount | The account is not eligable for refund. |
TooLowBalanceToMakeRefund | There is not enough funds to fulfill the refund request. |
AmountToRefundIsGreaterThanTransactionAmount | The amount specified to refund is greater than the original payment transaction itself. |
InternalServerError | Something unexpected happened. |