> ## Documentation Index
> Fetch the complete documentation index at: https://razorpay-881012b3.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Sofort - S2S Integration

> Let your customers make payments using Sofort on your website or app with S2S Integration.

<div style={{display:"flex",flexWrap:"wrap",alignItems:"center",gap:"0.35rem 0.9rem",border:"1px solid rgba(128,128,128,0.28)",borderRadius:"0.5rem",padding:"0.45rem 0.75rem",margin:"0 0 1.25rem",fontSize:"0.875rem"}}>
  <span style={{fontWeight:600}}>Available in</span>
  <span>🇮🇳 India</span>
</div>

<Info>
  **Feature Request**

  This is an on-demand feature. Please raise a request with our [Support team](https://razorpay.com/support/#request) to get this feature activated on your Razorpay account.
</Info>

## Prerequisites

1. [Sign up](https://dashboard.razorpay.com/#/access/signup) for a Razorpay account.
2. Generate API Keys.
   <iframe width="500" height="315" src="https://www.youtube.com/embed/6mJnOWZDhDo" title="Generate API Keys using Test Mode" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowFullScreen />
3. Follow the [Razorpay S2S Integration documentation](/docs/payments/payment-gateway/s2s-integration).

## Integrate Sofort on S2S

* Create an Order.
* Pass `method` and `provider` parameters in Create Payments API.

### Create an Order

Order is an important step in the payment process.

1. An order should be created for every payment.
2. You can create an order using the [Orders API](#api-sample-code). It is a server-side API call.  Know how to [authenticate](/docs/api/authentication#generate-api-keys) Orders API.
3. Pass the `order_id` received in response to the checkout. This ties the Order with the payment and secures the request from being tampered.

#### API Sample Code

The following is a sample API request and response for creating an order:

<CodeGroup>
  ```bash Curl theme={null}
  curl -X POST https://api.razorpay.com/v1/orders
  -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]
  -H 'content-type:application/json'
  -d '{
      "amount": 50000,
      "currency": "INR",
      "receipt": "rcptid_11"
  }'
  ```

  ```java Java theme={null}
  try {
    JSONObject orderRequest = new JSONObject();
    orderRequest.put("amount", 50000); // amount in the smallest currency unit
    orderRequest.put("currency", "INR");
    orderRequest.put("receipt", "order_rcptid_11");

    Order order = razorpay.Orders.create(orderRequest);
  } catch (RazorpayException e) {
    // Handle Exception
    System.out.println(e.getMessage());
  }
  ```

  ```python Python theme={null}
  import razorpay
  client = razorpay.Client(auth=("api_key", "api_secret"))

  DATA = {
      "amount": 100,
      "currency": "INR",
      "receipt": "receipt#1",
      "notes": {
          "key1": "value3",
          "key2": "value2"
      }
  }
  client.order.create(data=DATA)
  ```

  ```php PHP theme={null}
  $order  = $client->order->create([
    'receipt'         => 'order_rcptid_11',
    'amount'          => 50000, // amount in the smallest currency unit
    'currency'        => 'INR'// <a href="/docs/payments/international-payments/#supported-currencies" target="_blank">See the list of supported currencies</a>.)
  ]);
  ```

  ```csharp .NET theme={null}
  Dictionary<string, object> options = new Dictionary<string,object>();
  options.Add("amount", 50000); // amount in the smallest currency unit
  options.add("receipt", "order_rcptid_11");
  options.add("currency", "INR");
  Order order = client.Order.Create(options);
  ```

  ```ruby Ruby theme={null}
  options = amount: 50000, currency: 'INR', receipt: '<order_rcptid_11>'
  order = Razorpay::Order.create
  ```

  ```javascript Node.js theme={null}
  var options = {
    amount: 50000,  // amount in the smallest currency unit
    currency: "INR",
    receipt: "order_rcptid_11"
  };
  instance.orders.create(options, function(err, order) {
    console.log(order);
  });
  ```

  ```json Response theme={null}
  {
      "id": "order_DBJOWzybf0sJbb",
      "entity": "order",
      "amount": 50000,
      "amount_paid": 0,
      "amount_due": 50000,
      "currency": "INR",
      "receipt": "rcptid_11",
      "status": "created",
      "attempts": 0,
      "notes": [],
      "created_at": 1566986570
  }
  ```
</CodeGroup>

#### Request Parameters

Here is the list of parameters and their description for creating an order:

`amount` *mandatory*
: `integer` The transaction amount, expressed in the currency subunit. For example, for an actual amount of ₹299.35 , the value of this field should be `29935`.

`currency` *mandatory*
: `string` The currency in which the transaction should be made. See the [list of supported currencies](/docs/payments/international-payments#supported-currencies). Length must be 3 characters.

`receipt` *optional*
: `string` Your receipt id for this order should be passed here. Maximum length is 40 characters.

`notes` *optional*
: `json object` Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, `"note_key": "Beam me up Scotty”`.

`partial_payment` *optional*
: `boolean` Indicates whether the customer can make a partial payment. Possible values:

* `true`: The customer can make partial payments.
* `false` (default): The customer cannot make partial payments.

`id` *mandatory*
: `string` Unique identifier of the customer. For example, `cust_1Aa00000000004`.

Know more about [Orders API](/docs/api/orders).

#### Error Response Parameters

The error response parameters are available in the [API Reference Guide](/docs/api/orders/create).

### Pass method and provider Parameters in Create Payments API

The following is a sample API to create a payment.

<CodeGroup>
  ```bash Create Payment using JSON theme={null}
  curl -X POST https://api.razorpay.com/v1/payments/create/json \
  -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]
  -H 'content-type: application/json'
  -d '{
    "amount": 1000,
    "currency": "INR",
    "contact": 9900988990,
    "email": "gaurav.kumar@example.com",
    "order_id": "order_4xbQrmEoA5WJ0G",
    "provider": "sofort",
    "method" : "app"
  }'
  ```

  ```bash Create Payment using Redirect theme={null}
  curl -X POST https://api.razorpay.com/v1/payments/create/redirect \
  -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]
  -H 'content-type: application/json'
  -d '{
    "amount": 1000,
    "currency": "INR",
    "contact": 9900988990,
    "email": "gaurav.kumar@example.com",
    "order_id": "order_4xbQrmEoA5WJ0G",
    "provider": "sofort",
    "method" : "app"
  }'
  ```
</CodeGroup>

```json Response theme={null}
{
  "razorpay_payment_id": "pay_xxxx",
  "next": [
    {
      "action": "poll",
      "url": "https://api.razorpay.com/v1/payments/pay_xxx/status"
    }
  ]
}
```

#### Request Parameters

Along with the other Create Payment API request parameters, you must pass:

`method` *mandatory*
: `string` The method used to make the payment. Here, it should be `app`.

`provider` *mandatory if method=app*
: `string` Name of the PSP app. Here, it should be `sofort`.
