-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2006 from SwedbankPay/feature/dx-2207_post_purcha…
…se_31 DX-2207: Post Purchase 3.1 and other stuff.
- Loading branch information
Showing
11 changed files
with
740 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
{% capture features_url %}{% include utils/documentation-section-url.md href='/features' %}{% endcapture %} | ||
{% capture documentation_section %}{% include utils/documentation-section.md %}{% endcapture %} | ||
|
||
## Cancel v3.1 | ||
|
||
The `cancellations` resource lists the cancellation transactions on a | ||
specific payment. | ||
|
||
## Create Cancel Transaction | ||
|
||
{% if documentation_section contains "checkout-v3" %} | ||
|
||
To cancel a previously created payment, you must perform the `cancel` operation | ||
against the accompanying `href` returned in the `operations` list. You can only | ||
cancel a payment - or part of a payment - which has not been captured yet. | ||
|
||
{% else %} | ||
|
||
To cancel a previously created payment, you must perform the | ||
`create-paymentorder-cancel` operation against the accompanying `href` returned | ||
in the `operations` list. You can only cancel a payment - or part of a payment - | ||
which has not been captured yet. | ||
|
||
{% endif %} | ||
|
||
## Cancel Request v3.1 | ||
|
||
{:.code-view-header} | ||
**Request** | ||
|
||
```http | ||
POST /psp/paymentorders/{{ page.payment_order_id }}/cancellations HTTP/1.1 | ||
Host: {{ page.api_host }} | ||
Authorization: Bearer <AccessToken> | ||
Content-Type: application/json;version=3.1 | ||
{ | ||
"transaction": { | ||
"description": "Test Cancellation", | ||
"payeeReference": "ABC123" | ||
} | ||
} | ||
``` | ||
|
||
{:.table .table-striped} | ||
| Required | Field | Type | Description | | ||
| :--------------: | :----------------------- | :----------- | :--------------------------------------------------------------------------------------------- | | ||
| {% icon check %} | `transaction` | `object` | The transaction object. | | ||
| {% icon check %} | {% f description %} | `string` | A textual description of why the transaction is cancelled. | | ||
| {% icon check %} | {% f payeeReference %} | `string` | {% include fields/payee-reference.md %} | | ||
|
||
## Cancel Response v3.1 | ||
|
||
If the cancel request succeeds, the response should be similar to the | ||
example below: | ||
|
||
{:.code-view-header} | ||
**Response** | ||
|
||
```http | ||
HTTP/1.1 200 OK | ||
Content-Type: application/json; charset=utf-8; version=3.1 | ||
api-supported-versions: 3.1 | ||
{ | ||
"paymentOrder": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d", | ||
"created": "2020-03-03T07:19:27.5636519Z", | ||
"updated": "2020-03-03T07:21:00.5605905Z", | ||
"operation": "Purchase", | ||
"status": "Cancelled", | ||
"currency": "SEK", | ||
"amount": 1500, | ||
"vatAmount": 375, | ||
"remainingCaptureAmount": 0, | ||
"remainingCancellationAmount": 0, | ||
"remainingReversalAmount": 0, | ||
"description": "Test Purchase", | ||
"initiatingSystemUserAgent": "<should be set by the system calling POST:/psp/paymentorders>", | ||
"language": "sv-SE", | ||
"availableInstruments": [ "CreditCard", "Invoice-PayExFinancingSe", "Invoice-PayMonthlyInvoiceSe", "Swish", "CreditAccount", "Trustly" ], | ||
"implementation": "PaymentsOnly", | ||
"integration": "HostedView|Redirect", | ||
"instrumentMode": true, | ||
"guestMode": true, | ||
"orderItems": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/orderitems" | ||
}, | ||
"urls": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/urls" | ||
}, | ||
"payeeInfo": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/payeeInfo" | ||
}, | ||
"payer": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/payers" | ||
}, | ||
"history": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/history" | ||
}, | ||
"failed": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/failed" | ||
}, | ||
"aborted": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/aborted" | ||
}, | ||
"paid": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/paid" | ||
}, | ||
"cancelled": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/cancelled" | ||
}, | ||
"financialTransactions": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/financialtransactions" | ||
}, | ||
"failedAttempts": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/failedattempts" | ||
}, | ||
"postpurchaseFailedAttempts": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/postpurchasefailedattempts" | ||
}, | ||
"metadata": { | ||
"id": "/psp/paymentorders/8be318c1-1caa-4db1-e2c6-08d7bf41224d/metadata" | ||
} | ||
}, | ||
"operations": [ | ||
] | ||
} | ||
``` | ||
|
||
{% capture table %} | ||
{:.table .table-striped .mb-5} | ||
| Property | Type | Description | | ||
| :-------------------------- | :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| {% f paymentOrder, 0 %} | `string` | The relative URL of the payment order this capture transaction belongs to. | | ||
| {% f id %} | `string` | The relative URL of the created capture transaction. | | ||
| {% f created %} | `string` | The ISO-8601 date and time of when the transaction was created. | | ||
| {% f updated %} | `string` | The ISO-8601 date and time of when the transaction was updated. | | ||
| {% f operation %} | `string` | {% include fields/operation.md %} | | ||
| {% f status %} | `string` | {% include fields/status.md %} | | ||
| {% f currency %} | `string` | The currency of the payment order. | | ||
| {% f amount %} | `integer` | {% include fields/amount.md %} | | ||
| {% f vatAmount %} | `integer` | {% include fields/vat-amount.md %} | | ||
| {% f remainingCaptureAmount %} | `integer` | The remaining authorized amount that is still possible to capture. | | ||
| {% f remainingCancellationAmount %} | `integer` | The remaining authorized amount that is still possible to cancel. | | ||
| {% f remainingReversalAmount %} | `integer` | The remaining captured amount that is still available for reversal. | | ||
| {% f description %} | `string` | {% include fields/description.md %} | | ||
| {% f initiatingSystemUserAgent %} | `string` | {% include fields/initiating-system-user-agent.md %} | | ||
| {% f language %} | `string` | {% include fields/language.md %} | | ||
| {% f availableInstruments %} | `string` | A list of instruments available for this payment. | | ||
| {% f implementation %} | `string` | The merchant's Digital Payments implementation type. `Enterprise` or `PaymentsOnly`. We ask that you don't build logic around this field's response. It is mainly for information purposes, as the implementation types might be subject to name changes. If this should happen, updated information will be available in this table. | | ||
| {% f integration %} | `string` | The merchant's Digital Payments integration type. `HostedView` (Seamless View) or `Redirect`. This field will not be populated until the payer has opened the payment UI, and the client script has identified if Swedbank Pay or another URI is hosting the container with the payment iframe. We ask that you don't build logic around this field's response. It is mainly for information purposes. as the integration types might be subject to name changes, If this should happen, updated information will be available in this table. | | ||
| {% f instrumentMode %} | `bool` | Set to `true` or `false`. Indicates if the payment is initialized with only one payment instrument available. | | ||
| {% f guestMode %} | `bool` | Set to `true` or `false`. Indicates if the payer chose to pay as a guest or not. When using the Payments Only implementation, this is triggered by not including a `payerReference` in the original `paymentOrder` request. | | ||
| {% f orderItems %} | `string` | The URL to the `orderItems` resource where information about the order items can be retrieved. | | ||
| {% f urls %} | `string` | The URL to the `urls` resource where all URLs related to the payment order can be retrieved. | | ||
| {% f payeeInfo %} | `string` | {% include fields/payee-info.md %} | | ||
| {% f payer %} | `string` | The URL to the [`payer` resource]({{ features_url }}/technical-reference/resource-sub-models#payer) where information about the payer can be retrieved. | | ||
| {% f history %} | `string` | The URL to the `history` resource where information about the payment's history can be retrieved. | | ||
| {% f failed %} | `string` | The URL to the `failed` resource where information about the failed transactions can be retrieved. | | ||
| {% f aborted %} | `string` | The URL to the `aborted` resource where information about the aborted transactions can be retrieved. | | ||
| {% f paid %} | `string` | The URL to the `paid` resource where information about the paid transactions can be retrieved. | | ||
| {% f cancelled %} | `string` | The URL to the `cancelled` resource where information about the cancelled transactions can be retrieved. | | ||
| {% f financialTransactions %} | `string` | The URL to the `financialTransactions` resource where information about the financial transactions can be retrieved. | | ||
| {% f failedAttempts %} | `string` | The URL to the `failedAttempts` resource where information about the failed attempts can be retrieved. | | ||
| {% f postpurchaseFailedAttempts %} | `string` | The URL to the `postpurchaseFailedAttempts` resource where information about the failed capture, cancel or reversal attempts can be retrieved. | | ||
| {% f metadata %} | `string` | The URL to the `metadata` resource where information about the metadata can be retrieved. | | ||
| {% f operations %} | `array` | {% include fields/operations.md %} [See Operations for details]({{ features_url }}/technical-reference/operations). | | ||
{% endcapture %} | ||
{% include accordion-table.html content=table %} | ||
|
||
## Cancel Sequence Diagram | ||
|
||
Cancel can only be done on a authorized transaction. If you perform a cancel | ||
after doing a partial capture, you will cancel the remaining authorized amount. | ||
|
||
```mermaid | ||
sequenceDiagram | ||
participant SwedbankPay as Swedbank Pay | ||
Merchant->>SwedbankPay: POST < {{ include.api_resource }} cancellation> | ||
activate Merchant | ||
activate SwedbankPay | ||
SwedbankPay-->>Merchant: transaction resource | ||
deactivate SwedbankPay | ||
deactivate Merchant | ||
``` |
Oops, something went wrong.