Payments

Read about the record types payment transactions and payment methods before going through the examples below.

Payment methods are used to separate sales data and enable the data to be configured and booked to the correct account. A new “virtual” payment method can be added when needed.

Payment with a credit card

A common event sequence is when a customer places an order, pays the order to the PSP and the merchant receives the payment. In this example the customer pays the whole order with a credit card.

sequenceDiagram autonumber Customer-->>Webshop: Place order activate Webshop activate PSP Webshop-->>PSP: Register payment Webshop->>Integration Platform: Register prepare event Merchant-->>Customer: Deliver order Merchant-->>Webshop: Add shipment Webshop-->>PSP: Capture payment Webshop->>Integration Platform: Register payment event Integration Platform->>Accounting: Voucher for bookkeeping (for the sale) deactivate Webshop PSP-->>Customer: Collect payment PSP-->>Merchant: Payout bank account PSP->>Integration Platform: Register deposit event Integration Platform->>Accounting: Voucher for bookkeeping (for the deposit) deactivate PSP

The example below describes an e-commerce order:

  1. Custom places an order at the merchant’s webshop.
  2. A payment authorization has been done at the Payment Service Provider (PSP). A sales has taken place and the money is reserved at the end-customers bank account but no amount have been transferred yet.
  3. prepare - Start a payment transaction in the integration platform. Usually the integration platform imports the information from the webshop.
  4. The merchant prepares the order and then sends it to the customer.
  5. The merchants registers a shipment in the Webshop.
  6. The merchant notifies the PSP that the money should be withdrawn from the customers account (also called captured or finalized payment).
  7. payment - The previous step is registered in the integration platform as a payment event. This event indicates that the order is now paid by the customer but the merchant does not have access to the money yet. A common scenario is that the PSP apply a fee during this payment state, that fee should be registered as a fee in a separate field for this event.
  8. The integration platform creates a voucher for the sale that took place and register it in an accounting system.
  9. The Payment System Provider collects the payment.
  10. The PSP makes a payout to the merchants bank account meaning the merchant now has the money.
  11. deposit - The previous step is registered in the integration platform as a deposit event. The PSP could add a fee during the deposit, if this is the case then add the fee to the same event.
  12. The integration platform creates a voucher for the deposit that took place and register it in an accounting system.

Accounting

This example describes how the order information and payment transaction information can be used when registering the sale, payout and fees in an accounting system. The example is for a sale from a Swedish Merchant to a Swedish end customer (only 25% Vat rate is used).

Voucher for the sale in the webshop

Account Account name Description Debit Credit Source of data
3001 Sales within Sweden, 25 % VAT The sales amount excl Vat 80 Order
2611 Output VAT on sales in Sweden, 25 % The VAT amount 20 Order
1510 Accounts receivable – trade Receivable PSP 100 Order (or payment event)

Voucher for the payment from the PSP

Account Account name Description Debit Credit Source of data
1510 Accounts receivable – trade 100 Deposit event
1930 Business account/cheque account/current account Payout from the PSP 90 Deposit event
6570 Payment Cost The fee from PSP 8 Fee from the deposit event
2611 Output VAT on sales in Sweden, 25 % The Vat for the PSP fee 2 The 25% VAT for the deposit event fee
Warning

The information about accounting should be strictly be regarded as examples. Contact your accounting specialist for advice. Contact Sharespine for help that fits your use case before using this part of the API.

Payment with an invoice

A common event sequence is when a customer places and order, pays the order and the merchant receives the payment. In this example the customer pays the whole order with an invoice that is handled by the merchant.

sequenceDiagram autonumber Customer-->>Webshop: Place order activate Webshop Merchant-->>Customer: Deliver order Merchant-->>Webshop: Add shipment Merchant-->>Customer: Send invoice Merchant-->>Webshop: Update payment state Webshop->>Integration Platform: Register prepare and payment event Integration Platform->>Accounting: Voucher for bookkeeping (for the sale) deactivate Webshop Customer-->>Merchant: Invoice paid and money in bank account Merchant-->>Webshop: Update payment state Webshop->>Integration Platform: Register deposit event Integration Platform->>Accounting: Voucher for bookkeeping (for the deposit)
  1. Custom places an order at the merchant’s webshop.
  2. The merchant prepares the order and then sends it to the customer.
  3. The merchants registers a shipment in the Webshop.
  4. The merchant send the invoice to the customer.
  5. The merchant updates the payment state in the webshop.
  6. prepare and payment - The integration platform use the information from the webshop to register a transaction.
  7. A voucher for the sale is registered in the accounting system.
  8. The customer pays the invoice and the money reach the merchants bank account.
  9. The merchant updates the payment state in the webshop.
  10. deposit - The integration platform use the information from the webshop a deposit event.
  11. The integration platform creates a voucher for the deposit that took place and register it in the accounting system.

Accounting

This example describes how the order information and payment transaction information can be used when registering the sale and payout in an accounting system. The example is for a sale from a Swedish Merchant to a Swedish end customer (only 25% VAT rate is used).

Sale from the webshop

Account Account name Description Debit Credit Source of data
3001 Sales within Sweden, 25 % VAT The sales amount excl Vat 80 Order
2611 Output VAT on sales in Sweden, 25 % The VAT amount 20 Order
1510 Accounts receivable – trade Receivable PSP 100 Order (or payment event)

Payment from a PSP

Account Account name Description Debit Credit Source of data
1510 Accounts receivable – trade 100 Deposit event
1930 Business account/cheque account/current account Payout from the PSP 100 Deposit event
Warning

The information about accounting should be strictly be regarded as examples. Contact your accounting specialist for advice. Contact Sharespine for help that fits your use case before using this part of the API.

Pay with a giftcard

sequenceDiagram autonumber Customer-->>Webshop: Place order Merchant-->>Customer: Deliver order Merchant-->>Webshop: Add shipment Merchant-->>Webshop: Update payment state Webshop->>Integration Platform: Register payment event Integration Platform->>Accounting: Voucher for bookkeeping (for the sale) Integration Platform->>Accounting: Voucher for bookkeeping (for the payment)
  1. Custom places an order at the merchant’s webshop.
  2. The merchant prepares the order and then sends it to the customer.
  3. The merchants registers a shipment in the Webshop.
  4. The merchant updates the payment state in the webshop.
  5. prepare and payment - The integration platform use the information from the webshop to register a transaction.
  6. A voucher for the sale is registered in the accounting system.
  7. The integration platform creates a voucher for the payment when using giftcard.
Note

A giftcard does not have a deposit-event.

Accounting

This example describes how payment transaction information can be used when registering a payment with a giftcard. The example is for a sale from a Swedish Merchant to a Swedish end customer (only 25% VAT rate is used).

Note

This example only handles the accounting part for a sale that is paid with a giftcard. The accounting for the sale of the giftcard is not a part of this example.

Sale from the webshop

Account Account name Description Debit Credit Source of data
3001 Sales within Sweden, 25 % VAT The sales amount excl Vat 80 Order
2611 Output VAT on sales in Sweden, 25 % The VAT amount 20 Order

Payment from a PSP

Account Account name Description Debit Credit Source of data
2421 Unused gift vouchers 100 Payment event
Warning

The information about accounting should be strictly be regarded as examples. Contact your accounting specialist for advice. Contact Sharespine for help that fits your use case before using this part of the API.

Canceled payment

A common event sequence is when a customer places and order but cancels the order before the payment have been captured. In this example the customer plans to pay the whole order with a credit card but cancels the order before any capture of the payment has occurred.

sequenceDiagram autonumber Customer-->>Webshop: Place order Webshop-->>PSP: Register payment Webshop->>Integration Platform: Register prepare event Customer-->>Webshop: Cancel order Webshop-->>PSP: Cancel payment Webshop->>Integration Platform: Register cancel event
  1. Customer places an order at the merchant
  2. prepare - Payment initiated/reserved in external system, meaning a sale has taken place.
  3. The integration platform use the information from the webshop to register a transaction.
  4. The customer cancels the order before the payment has been processed.
  5. The webshop cancels the payment in the PSP. (The reserved money is released)
  6. cancel - Payment canceled in the external system (possible since the payment was never paid by the customer).

Multiple payment methods

This example describes a purchase paid with both a credit card and a giftcard.

sequenceDiagram autonumber Customer-->>Webshop: Place order activate Webshop activate PSP Webshop-->>Webshop: Register initial payment with giftcard Webshop->>Integration Platform: Register prepare event (T1) Webshop-->>PSP: Register payment with credit card Webshop->>Integration Platform: Register prepare event (T2) Merchant-->>Customer: Deliver order Merchant-->>Webshop: Add shipment Webshop-->>Webshop: Register finalize payment for giftcard Webshop->>Integration Platform: Register payment event (T1) Integration Platform->>Accounting: Voucher for bookkeeping (for the sale T1) Integration Platform->>Accounting: Voucher for bookkeeping payment (for the sale T1) Webshop-->>PSP: Capture payment Webshop->>Integration Platform: Register payment event (T2) Integration Platform->>Accounting: Voucher for bookkeeping (for the sale T2) deactivate Webshop PSP-->>Customer: Collect payment PSP-->>Merchant: Payout bank account PSP->>Integration Platform: Register deposit event Integration Platform->>Accounting: Voucher for bookkeeping (for the deposit T2) deactivate PSP
Note
  • T1 = transaction 1
  • T2 = transaction 2
  1. Custom places an order at the merchant’s webshop.
  2. The giftcard have been used in the webshop. This is regarded as a special payment method.
  3. prepare - Start a payment transaction in the integration platform for the giftcard T1.
  4. A payment authorization has been done at the Payment Service Provider (PSP). A sales has taken place and the money is reserved at the end-customers bank account but no amount have been transferred yet.
  5. prepare - Start a payment transaction in the integration platform for the credit card. T2
  6. The merchant prepares the order and then sends it to the customer.
  7. The merchants registers a shipment in the Webshop.
  8. The giftcard is now registered as used as payment for a part of the order.
  9. payment - The integration platform use the information from the webshop to register the transaction of the giftcard. T1
  10. A voucher for the sale is registered in the accounting system. T1
  11. The integration platform creates a voucher for the payment when using giftcard.
  12. The merchant notifies the PSP that the money should be withdrawn from the customers account (also called captured or finalized payment).
  13. payment - The previous step is registered in the integration platform as a payment event. This event indicates that the order is now paid by the customer but the merchant does not have access to the money yet. T2 A common scenario is that the PSP apply a fee during this payment state, that fee should be registered as a fee in a separate field for this event.
  14. The integration platform creates a voucher for the sale that took place and register it in an accounting system. T2
  15. The PSP collects the payment.
  16. The PSP makes a payout to the merchants bank account meaning the merchant now has the money.
  17. deposit - The previous step is registered in the integration platform as a deposit event. The PSP could add a fee during the deposit, add the fee to the same event. T2
  18. The integration platform creates a voucher for the deposit that took place and register it in an accounting system.

Accounting

See examples for payment with credit card and payment with giftcard for examples on how the transactions can be used for settlement. It is important to use different payment methods in the integration platform for giftcard and credit card to enable configuration for the correct accounts.

Returned payment

In this example the customer pays the whole order with one payment method e.g. credit card. The customer later returns the whole order to the merchant.

sequenceDiagram autonumber Customer-->>Webshop: Place order activate Webshop activate PSP Webshop-->>PSP: Register payment Webshop->>Integration Platform: Register prepare event Merchant-->>Customer: Deliver order Merchant-->>Webshop: Add shipment Webshop-->>PSP: Capture payment Webshop->>Integration Platform: Register payment event Integration Platform->>Accounting: Voucher for bookkeeping (for the sale) deactivate Webshop PSP-->>Customer: Collect payment PSP-->>Merchant: Payout bank account PSP->>Integration Platform: Register deposit event Integration Platform->>Accounting: Voucher for bookkeeping (for the deposit) deactivate PSP Customer-->>Merchant: Return order Merchant-->>Webshop: update order/payment state Webshop-->>PSP: Request a customer refund Webshop->>Integration Platform: Register refund event Integration Platform->>Accounting: Voucher for bookkeeping (for the refund) PSP-->>Customer: Return the payment Merchant-->>PSP: Return payment to PSP PSP-->>Webshop: update payment state Webshop->>Integration Platform: Register credit event Integration Platform->>Accounting: Voucher for bookkeeping (for the credit)
  1. Custom places an order at the merchant’s webshop.
  2. A payment authorization has been done at the Payment Service Provider (PSP). A sales has taken place and the money is reserved at the end-customers bank account but no amount have been transferred yet.
  3. prepare - Start a payment transaction in the integration platform.
  4. The merchant prepares the order and then sends it to the customer.
  5. The merchants registers a shipment in the Webshop.
  6. The merchant notifies the PSP that the money should be withdrawn from the customers account (also called captured or finalized payment).
  7. payment - The previous step is registered in the integration platform as a payment event. This event indicates that the order is now paid by the customer but the merchant does not have access to the money yet. A common scenario is that the PSP apply a fee during this payment state, that fee should be registered as a fee in a separate field for this event.
  8. The integration platform creates a voucher for the sale that took place and register it in an accounting system.
  9. The Payment System Provider collects the payment.
  10. The PSP makes a payout to the merchants bank account meaning the merchant now has the money.
  11. deposit - The previous step is registered in the integration platform as a deposit event. The PSP could add a fee during the deposit, add the fee to the same event.
  12. The integration platform creates a voucher for the deposit that took place and register it in an accounting system.
  13. The customer returns the order
  14. The merchant updates the order and payment state in the webshop.
  15. The Webshop requests a customer refund from the PSP.
  16. refund - The integration platform use the information from the webshop to register a refund event.
  17. A voucher can be created for the accounting system to adjust the sales accounts.
  18. The PSP returns the payment to the customer.
  19. The merchant returns the money to the PSP (uncommon scenario)
  20. Update payment state in the webshop.
  21. credit - The integration platform use information from the webshop to register a credit event.
  22. A voucher can be created for the credit in the accounting system. A fee could be added during this stage. A negative fee would represent that the original fee is deducted from the requested amount. A positive fee would indicate that the PSP takes an additional fee for the credit process.

Events

Below is examples of events with values:

Event Description Amount Fee Accumulated fee
prepare Auth payment: registering the payment +100 0 0
payment Capture payment +100 0 0
deposit Deposit amount: with a fee for the deposit +90 +10 10
refund Refund payment +100 0 10
credit Credit amount where a part of the deposit fee is deducted +95 -5 5
Note

All amounts in an event has to be in the same currency. Tax information is needed for the fees.

Accounting

Sale from the webshop

The merchant have made a sale and registered a payment at the PSP.

Account Account name Description Debit Credit Source of data
3001 Sales within Sweden, 25 % VAT The sales amount excl Vat 80 Order
2611 Output VAT on sales in Sweden, 25 % The VAT amount 20 Order
1510 Accounts receivable – trade Receivable PSP 100 Order (or payment event)

Payment from a PSP

The Merchant registers that the money have been payed out from the PSP.

Account Account name Description Debit Credit Source of data
1510 Accounts receivable – trade 100 Deposit event
1930 Business account/cheque account/current account Payout from the PSP 90 Deposit event
6570 Payment Cost The fee from PSP 8 Fee from the deposit event
2611 Output VAT on sales in Sweden, 25 % The Vat for the PSP fee 2 The 25% VAT for the deposit event fee

Register a full refund

The Merchant registers a full customer refund at the PSP.

Account Account name Description Debit Credit Source of data
2410 Other current liabilities to credit institutions Liability to PSP 100 Refund event
3001 Sales within Sweden, 25 % VAT The sales amount excl Vat 80 Refund event
2611 Output VAT on sales in Sweden, 25 % The VAT amount 20 Refund event

Register a full credit

The Merchant actually pays the money back to the PSP.

In this example the deposit fee is returned by the PSP i.e. a negative fee.

Account Account name Description Debit Credit Source of data
2410 Other current liabilities to credit institutions 100 Credit event
1930 Business account/cheque account/current account Refund to PSP 95 Credit event
6570 Payment Cost The fee from PSP 4 Fee from the credit event
2611 Output VAT on sales in Sweden, 25 % The Vat for the PSP fee 1 The 25% VAT for the credit event fee

An alternative example when an additional fee new fee is added to the credit event.

Account Account name Description Debit Credit Source of data
2410 Other current liabilities to credit institutions 100 Credit event
1930 Business account/cheque account/current account Refund to PSP 105 Credit event
6570 Payment Cost The fee from PSP 4 Fee from the credit event
2611 Output VAT on sales in Sweden, 25 % The Vat for the PSP fee 1 The 25% VAT for the credit event fee
Warning

The information about accounting should be strictly be regarded as examples. Contact your accounting specialist for advice. Contact Sharespine for help that fits your use case before using this part of the API.

Related information