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

# Credit Card

> Initiate a credit card collection. Returns a hosted checkoutUrl — redirect the customer there to enter card details.

Credit card collections return a hosted `checkoutUrl`. Redirect your customer to that URL to complete paymentreturn a hosted `checkoutUrl`. Redirect your customer to that URL to complete payment.

```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": 500,
    "payment_mode": "CREDIT_CARD",
    "order_id": "TXN_98767",
    "customer_info": {
      "name": "John Doe",
      "email": "johndoe@example.com",
      "phone_country_code": "+91",
      "phone": "9999988888"
    }
  }'
```

```javascript Node.js theme={"dark"}
const 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' };
const body = { amount: 500, payment_mode: 'CREDIT_CARD', order_id: 'TXN_98767', customer_info: { name: 'John Doe', email: 'johndoe@example.com', phone_country_code: '+91', phone: '9999988888' } };
const response = await fetch('https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in', { method: 'POST', headers, body: JSON.stringify(body) });
console.log(await response.json());
```

```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": 500,
        "payment_mode": "CREDIT_CARD",
        "order_id": "TXN_98767",
        "customer_info": {
            "name": "John Doe",
            "email": "johndoe@example.com",
            "phone_country_code": "+91",
            "phone": "9999988888",
        },
    },
)

print(response.json())
```

```java Java theme={"dark"}
var body = "{\"amount\":500,\"payment_mode\":\"CREDIT_CARD\",\"order_id\":\"TXN_98767\",\"customer_info\":{\"name\":\"John Doe\",\"email\":\"johndoe@example.com\",\"phone_country_code\":\"+91\",\"phone\":\"9999988888\"}}";
var request = java.net.http.HttpRequest.newBuilder(java.net.URI.create("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").POST(java.net.http.HttpRequest.BodyPublishers.ofString(body)).build();
var response = java.net.http.HttpClient.newHttpClient().send(request, java.net.http.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":500,"payment_mode":"CREDIT_CARD","order_id":"TXN_98767","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' => 500, 'payment_mode' => 'CREDIT_CARD', 'order_id' => 'TXN_98767',
    '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: 500, payment_mode: "CREDIT_CARD", order_id: "TXN_98767", 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_98767",
    "statusDesc": "Transaction initiated successfully",
    "status": "INITIATED",
    "checkoutUrl": "https://example.com/checkout",
    "ref_id": "XXXXXXXXXXXXXXXXXXX"
  }
}
```


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