> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# UPI VPA

> Initiate a UPI VPA collection. Sends a collect request to the customer's UPI ID for approval in their UPI app.

Use UPI VPA to send a collect request to the customer's UPI ID. The customer approves it in their UPI app.

```bash Shell theme={"dark"}
curl --location 'https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in' \
  --header 'x-api-key: YOUR_SECRET_KEY' \
  --header 'Content-Type: application/json' \
  --header 'user-agent: YOUR_USER_AGENT' \
  --header 'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT' \
  --header 'x-source-channel: web' \
  --data '{
    "amount": 100,
    "payment_mode": "VPA",
    "upi_id": "johndoe@upi",
    "order_id": "TXN_98766",
    "customer_info": {
      "name": "John Doe",
      "email": "johndoe@example.com",
      "phone_country_code": "+91",
      "phone": "9999988888"
    }
  }'
```

```javascript Node.js theme={"dark"}
const response = await fetch(
  'https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in',
  {
    method: 'POST',
    headers: {
      'x-api-key': 'YOUR_SECRET_KEY',
      'Content-Type': 'application/json',
      'user-agent': 'YOUR_USER_AGENT',
      'x-browser-fingerprint': 'YOUR_BROWSER_FINGERPRINT',
      'x-source-channel': 'web'
    },
    body: JSON.stringify({
      amount: 100,
      payment_mode: 'VPA',
      upi_id: 'johndoe@upi',
      order_id: 'TXN_98766',
      customer_info: {
        name: 'John Doe',
        email: 'johndoe@example.com',
        phone_country_code: '+91',
        phone: '9999988888'
      }
    })
  }
);

const data = await response.json();
console.log(data);
```

```python Python theme={"dark"}
import requests

response = requests.post(
    "https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in",
    headers={
        "x-api-key": "YOUR_SECRET_KEY",
        "Content-Type": "application/json",
        "user-agent": "YOUR_USER_AGENT",
        "x-browser-fingerprint": "YOUR_BROWSER_FINGERPRINT",
        "x-source-channel": "web",
    },
    json={
        "amount": 100,
        "payment_mode": "VPA",
        "upi_id": "johndoe@upi",
        "order_id": "TXN_98766",
        "customer_info": {
            "name": "John Doe",
            "email": "johndoe@example.com",
            "phone_country_code": "+91",
            "phone": "9999988888",
        },
    },
)

print(response.json())
```

```java Java theme={"dark"}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

String body = """
{
  "amount": 100,
  "payment_mode": "VPA",
  "upi_id": "johndoe@upi",
  "order_id": "TXN_98766",
  "customer_info": {
    "name": "John Doe",
    "email": "johndoe@example.com",
    "phone_country_code": "+91",
    "phone": "9999988888"
  }
}
""";

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in"))
    .header("x-api-key", "YOUR_SECRET_KEY")
    .header("Content-Type", "application/json")
    .header("user-agent", "YOUR_USER_AGENT")
    .header("x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT")
    .header("x-source-channel", "web")
    .POST(HttpRequest.BodyPublishers.ofString(body))
    .build();

HttpResponse<String> response = HttpClient.newHttpClient()
    .send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

```go Go theme={"dark"}
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	body := []byte(`{
  "amount": 100,
  "payment_mode": "VPA",
  "upi_id": "johndoe@upi",
  "order_id": "TXN_98766",
  "customer_info": {
    "name": "John Doe",
    "email": "johndoe@example.com",
    "phone_country_code": "+91",
    "phone": "9999988888"
  }
}`)

	request, err := http.NewRequest(
		http.MethodPost,
		"https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in",
		bytes.NewBuffer(body),
	)
	if err != nil {
		panic(err)
	}

	request.Header.Set("x-api-key", "YOUR_SECRET_KEY")
	request.Header.Set("Content-Type", "application/json")
	request.Header.Set("user-agent", "YOUR_USER_AGENT")
	request.Header.Set("x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT")
	request.Header.Set("x-source-channel", "web")

	response, err := http.DefaultClient.Do(request)
	if err != nil {
		panic(err)
	}
	defer response.Body.Close()

	data, _ := io.ReadAll(response.Body)
	fmt.Println(string(data))
}
```

```php PHP theme={"dark"}
<?php

$curl = curl_init(
    'https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in'
);

curl_setopt_array($curl, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'x-api-key: YOUR_SECRET_KEY',
        'Content-Type: application/json',
        'user-agent: YOUR_USER_AGENT',
        'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT',
        'x-source-channel: web',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'amount' => 100,
        'payment_mode' => 'VPA',
        'upi_id' => 'johndoe@upi',
        'order_id' => 'TXN_98766',
        'customer_info' => [
            'name' => 'John Doe',
            'email' => 'johndoe@example.com',
            'phone_country_code' => '+91',
            'phone' => '9999988888',
        ],
    ]),
    CURLOPT_RETURNTRANSFER => true,
]);

$response = curl_exec($curl);
curl_close($curl);

echo $response;
```

```ruby Ruby theme={"dark"}
require "json"
require "net/http"

uri = URI("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in")
request = Net::HTTP::Post.new(uri, {"x-api-key" => "YOUR_SECRET_KEY", "Content-Type" => "application/json", "user-agent" => "YOUR_USER_AGENT", "x-browser-fingerprint" => "YOUR_BROWSER_FINGERPRINT", "x-source-channel" => "web"})
request.body = {amount: 100, payment_mode: "VPA", upi_id: "johndoe@upi", order_id: "TXN_98766", customer_info: {name: "John Doe", email: "johndoe@example.com", phone_country_code: "+91", phone: "9999988888"}}.to_json
puts Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request).body }
```

```json 200 theme={"dark"}
{
  "status": "SUCCESS",
  "status_code": 200,
  "message": "Transaction initiated successfully",
  "detail": null,
  "data": {
    "orderId": "TXN_98766",
    "statusDesc": "Transaction initiated successfully",
    "status": "INITIATED",
    "payerVPA": "johndoe@upi",
    "payerName": "John Doe",
    "ref_id": "XXXXXXXXXXXXXXXXXXX"
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.