# Successful payment for order (with payment and transaction details)

Xsolla sends the order_paid webhook to the specified URL when the user successfully pays for the order.

The order_paid webhook contains information about the purchased items, payment data and transaction details.

The order_paid webhook is not sent if the payment is not successful, for example:
* the payment form was opened, but the user did not pay for the order
* the payment form was opened, but there were errors during the payment

It is recommended that the processing time of the order_paid  webhook  is less than 3 seconds.


  Notice
  The set of fields sent in a webhook depends on the following settings:the ones you configured in the account in the Settings &gt; Webhooks &gt; Advanced settings sectionthe ones configured on the Xsolla sideIf you have any questions, contact your Customer Success Manager or email to csm@xsolla.com.


The expected answers are described in the Responses section.
You can use other response codes. Depending on the response code and the connection of the automatic payment refund functionality, the webhook processing logic on Xsolla’s side is as follows:


    
    
        Response code
        Automatic payment refund is disabled (by default)
        Automatic payment refund is enabled
    
    
    
    
        400, 401, 402, 403, 404, 409, 422, 415
        No actions
        Automatic refund to the user
    
    
        200, 201, 204
        No actions
        No actions
    
    
        Different code or no response to webhook
        Multiple webhooks are sent within a specified time interval: 2 attempts with a 5-minute interval, 7 attempts with a 15-minute interval, 10 attempts with a 60-minute interval.
        Multiple webhooks are sent within a specified time interval: 2 attempts with a 5-minute interval, 7 attempts with a 15-minute interval, 10 attempts with a 60-minute interval. If all webhooks are sent but a successful response is not received, an automatic refund is issued to the user.
    
    


To connect the automatic refund functionality, contact your Customer Success Managers or email to csm@xsolla.com.

Endpoint: POST successful-order-payment
Version: 1.0

## Request fields (application/json):

  - `notification_type` (string, required)
    Notification type.

  - `items` (array, required)
    List of items purchased by the user.

The set of parameters included in the array depends on the webhook version. Version 2 includes additional parameters: is_free, is_bonus, and is_bundle_content. To switch the version, pass its number in the version parameter in the [Update webhook version](/api/catalog/common-webhooks/update-webhook-version/) API call.

  - `order` (object, required)
    Information about the order.

  - `order.id` (integer, required)
    Unique identifier of the user's order on the Xsolla’s side.

  - `order.mode` (string, required)
    Payment mode. default is used for real payments; sandbox for test payments.
    Enum: "default", "sandbox"

  - `order.currency_type` (string, required)
    Payment currency type. For a free order, unknown value is specified.
    Enum: "real", "virtual", "unknown", "loyalty_point"

  - `order.currency` (string, required)
    Currency of order. Virtual currency uses the SKU and real currency uses a three-letter [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code.

  - `order.amount` (string, required)
    The total cost of a cart based on the chosen currency.

  - `order.status` (string, required)
    Order status.

  - `order.platform` (string,null, required)
    Payment platform. The xsolla value is used for payments via Xsolla. For other payments, the value corresponding to the name of the game publishing platform is used.
    Enum: "xsolla", "playstation_network", "xbox_live", "pc_standalone", "nintendo_shop", "google_play", "app_store_ios", "android_standalone", "ios_standalone", "android_other", "ios_other", "pc_other"

  - `order.comment` (string,null, required)
    User’s commentary to the order.

  - `order.invoice_id` (string,null, required)
    Real currency payments invoice ID. Virtual currency payments or free items have a null value.

  - `order.promotions` (array, required)
    Applied promotions for the entire order.
The array is returned in the following cases:
  - A promotion affects the total purchase amount, such as a promo code with the Discount on purchase setting.
  - No discount is applied to the purchase, but bonus items are added to the order. In this case, the values for the cost with discount ([amount_with_discount](/webhooks/#operation/order-cancellation!path=order/promotions/amount_with_discount&t=request)) and without discount ([amount_without_discount](/webhooks/#operation/order-cancellation!path=order/promotions/amount_without_discount&t=request)) are returned and identical, since no discount is applied.

If no order-level promotions are applied, an empty array is returned.

  - `order.promotions.amount_without_discount` (string)
    Total cost of items without a discount.

  - `order.promotions.amount_with_discount` (string)
    Total cost of items with a discount.

  - `order.promotions.sequence` (integer)
    Order of promotions application.

  - `order.coupons` (array)
    Applied coupons. If the coupon isn’t applied, the array doesn’t return.

  - `order.coupons.code` (string)
    The code of an applied coupon.

  - `order.coupons.external_id` (string)
    External ID.

  - `order.promocodes` (array)
    Applied promocodes. If the promocode isn’t applied, the array doesn’t return.

  - `order.promocodes.code` (string)
    The code of an applied promocode.

  - `order.promocodes.external_id` (string)
    External ID.

  - `user` (object, required)
    User information.

  - `user.external_id` (string, required)
    User ID.

  - `user.email` (string, required)
    User email address.

  - `user.country` (string)
    User’s country. Two-letter uppercase [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code.

  - `billing` (object)
    Transaction and payment details.

  - `billing.notification_type` (string, required)
    Notification type.

  - `billing.settings` (object)
    Custom project settings (object).

  - `billing.settings.project_id` (integer)
    Project ID. You can find this parameter in your [account](/webhooks/overview/#business-accounts) next to the name of the project.

  - `billing.settings.merchant_id` (integer)
    Merchant ID.

  - `billing.purchase` (object)
    Purchase details (object).

  - `billing.purchase.subscription` (object)
    Subscription details (object).

  - `billing.purchase.subscription.plan_id` (string)
    Plan ID (external if the plan was created via API).

  - `billing.purchase.subscription.subscription_id` (integer)
    Subscription ID in Xsolla database.

  - `billing.purchase.subscription.product_id` (string)
    Product ID (if sent in the access token).

  - `billing.purchase.subscription.tags` (array)
    Plan tags.

  - `billing.purchase.subscription.date_create` (string)
    Subscription creation date. Date and time per [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601).

  - `billing.purchase.subscription.date_next_charge` (string)
    Next billing date. Date and time per [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601).

  - `billing.purchase.subscription.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.purchase.subscription.amount` (number)
    Price in real currency.

  - `billing.purchase.gift` (object)
    Gift details (object).

  - `billing.purchase.gift.giver_id` (string)
    Giver ID.

  - `billing.purchase.gift.receiver_id` (string)
    Gift recipient ID.

  - `billing.purchase.gift.receiver_email` (string)
    Gift recipient email.

  - `billing.purchase.gift.message` (string)
    Message from the giver.

  - `billing.purchase.gift.hide_giver_from_receiver` (string)
    Whether to hide the giver identity from the recipient.

  - `billing.purchase.total` (object, required)
    Total price of purchase (object).

  - `billing.purchase.total.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.purchase.total.amount` (number)
    Total payment amount.

  - `billing.purchase.promotions` (array)
    Promotions applied to this transaction.

  - `billing.purchase.promotions.technical_name` (string)
    Technical name of the promotion.

  - `billing.purchase.promotions.id` (integer)
    Promotion ID.

  - `billing.purchase.coupon` (object)
    Coupon details (object; if a coupon was used when creating the subscription).

  - `billing.purchase.coupon.coupon_code` (string)
    Coupon code.

  - `billing.purchase.coupon.campaign_code` (string)
    Campaign code.

  - `billing.transaction` (object, required)
    Transaction details (object).

  - `billing.transaction.id` (integer)
    Transaction ID.

  - `billing.transaction.external_id` (string)
    Transaction external ID. Refer to the [FAQs](/doc/pay-station/references/faq/#faq_payments_q_new_transaction_external_id) for detailed information.

  - `billing.transaction.payment_date` (string)
    Date of payment.

  - `billing.transaction.payment_method` (integer)
    Payment method ID.

  - `billing.transaction.payment_method_name` (string)
    Payment method name.

  - `billing.transaction.payment_method_order_id` (string)
    Payment ID in the payment system.

  - `billing.transaction.dry_run` (integer)
    Test transaction. The parameter has the 1 value if it is a test transaction, or is not sent if the transaction is real.

  - `billing.transaction.agreement` (integer)
    Agreement ID.

  - `billing.payment_details` (object, required)
    Payment details (object).

  - `billing.payment_details.payment` (object)
    Amount paid by the user (object).

  - `billing.payment_details.payment.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.payment.amount` (number)
    Amount.

  - `billing.payment_details.payment_method_sum` (object)
    Amount debited from the payment system.

  - `billing.payment_details.payment_method_sum.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.payment_method_sum.amount` (number)
    Amount.

  - `billing.payment_details.xsolla_balance_sum` (object)
    Amount debited from Xsolla balance.

  - `billing.payment_details.xsolla_balance_sum.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.xsolla_balance_sum.amount` (number)
    Amount.

  - `billing.payment_details.payout` (object)
    Payout details (object).

  - `billing.payment_details.payout.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.payout.amount` (number)
    Amount.

  - `billing.payment_details.vat` (object)
    VAT details (object; EU only).

  - `billing.payment_details.vat.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.vat.amount` (number)
    Amount.

  - `billing.payment_details.vat.percent` (number)
    VAT rate.

  - `billing.payment_details.payout_currency_rate` (string)
    Exchange rate between payment and payout currencies.

  - `billing.payment_details.country_wht` (object)
    Object with data on withholding costs applied in specific countries due to cross-border transactions.

  - `billing.payment_details.country_wht.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.country_wht.amount` (number)
    Amount.

  - `billing.payment_details.country_wht.percent` (number)
    Percent of the withholding cost rate.

  - `billing.payment_details.user_acquisition_fee` (object)
    Total amount of user acquisition fees deducted for the purchases made via affiliate networks and influencers (object).

  - `billing.payment_details.user_acquisition_fee.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.user_acquisition_fee.amount` (number)
    Amount.

  - `billing.payment_details.user_acquisition_fee.percent` (number)
    User acquisition fee rate, %.

  - `billing.payment_details.xsolla_fee` (object)
    Xsolla fee (object).

  - `billing.payment_details.xsolla_fee.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.xsolla_fee.amount` (number)
    Amount.

  - `billing.payment_details.payment_method_fee` (object)
    Payment system fee.

  - `billing.payment_details.payment_method_fee.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.payment_method_fee.amount` (number)
    Amount.

  - `billing.payment_details.sales_tax` (object)
    Sales tax (object; USA and Canada only).

  - `billing.payment_details.sales_tax.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.sales_tax.amount` (number)
    Amount.

  - `billing.payment_details.sales_tax.percent` (number)
    Sales tax rate.

  - `billing.payment_details.direct_wht` (object)
    Direct withholding tax.

  - `billing.payment_details.direct_wht.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.direct_wht.amount` (number)
    Amount.

  - `billing.payment_details.direct_wht.percent` (number)
    Direct withholding tax rate.

  - `billing.payment_details.repatriation_commission` (object)
    Object with data on repatriation costs, imposed on Xsolla by third parties.

  - `billing.payment_details.repatriation_commission.currency` (string)
    Currency. Three-letter currency code per [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217).

  - `billing.payment_details.repatriation_commission.amount` (number)
    Amount.

  - `custom_parameters` (object)
    Additional information.


## Response 200 fields

## Response 400 fields
