> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://beta-docs.payabli.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://beta-docs.payabli.com/_mcp/server.

# Make a sale transaction

This guide explains how to make a sale (a money in payment transaction) with the Payabli API. This method authorizes and captures a payment in one step, so when a transaction is submitted, it's immediately captured for settlement.

> **Warning**
>
> If aren't using a stored payment method provided by an embedded component to run transactions, you must secure cardholder, bank account data, and customer IP address because your PCI scope is expanded.

To make a sale transaction, send a POST request to `/api/MoneyIn/getpaid`. This endpoint is used to process payments for all payment methods, including credit cards, ACH, stored methods, cash, check, and cloud payments.

The request requires several parameters, which can depend on the payment method used. The following are required for all payment methods:

* `entryPoint` The ID of the paypoint making the sale
* `paymentMethod`: Information about the payment method
* `paymentDetails` Information about the payment itself
* `customerData` Information about the customer

Although not required, we strongly recommend passing the `ipaddress` parameter. This is used for risk analysis and fraud prevention.

For a full list of available parameters, see the [API reference](/api-reference/moneyin/make-a-transaction) for this endpoint.

## Examples

Each of these examples runs a transaction for \$100, with no service fee, for entrypoint `f743aed24a` and customer ID is `4440`.The only difference in each example is the payment method used.

#### Card

The Card payment method is used for credit and debit card payments.

### Request

POST [https://api-sandbox.payabli.com/api/MoneyIn/getpaid](https://api-sandbox.payabli.com/api/MoneyIn/getpaid)

**`Card`**

```curl Card
curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
     -H "requestToken: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "cardcvv": "999",
    "cardexp": "02/27",
    "cardHolder": "John Cassian",
    "cardnumber": "4111111111111111",
    "cardzip": "12345",
    "initiator": "payor",
    "method": "card"
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}'
```

**`Card`**

```python Card
import requests

url = "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

payload = {
    "paymentDetails": {
        "totalAmount": 100,
        "serviceFee": 0
    },
    "paymentMethod": {
        "cardcvv": "999",
        "cardexp": "02/27",
        "cardHolder": "John Cassian",
        "cardnumber": "4111111111111111",
        "cardzip": "12345",
        "initiator": "payor",
        "method": "card"
    },
    "customerData": { "customerId": 4440 },
    "entryPoint": "f743aed24a",
    "ipaddress": "255.255.255.255"
}
headers = {
    "requestToken": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`Card`**

```javascript Card
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid';
const options = {
  method: 'POST',
  headers: {requestToken: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"paymentDetails":{"totalAmount":100,"serviceFee":0},"paymentMethod":{"cardcvv":"999","cardexp":"02/27","cardHolder":"John Cassian","cardnumber":"4111111111111111","cardzip":"12345","initiator":"payor","method":"card"},"customerData":{"customerId":4440},"entryPoint":"f743aed24a","ipaddress":"255.255.255.255"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Card`**

```go Card
package main

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

func main() {

	url := "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

	payload := strings.NewReader("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"cardcvv\": \"999\",\n    \"cardexp\": \"02/27\",\n    \"cardHolder\": \"John Cassian\",\n    \"cardnumber\": \"4111111111111111\",\n    \"cardzip\": \"12345\",\n    \"initiator\": \"payor\",\n    \"method\": \"card\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Card`**

```ruby Card
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"cardcvv\": \"999\",\n    \"cardexp\": \"02/27\",\n    \"cardHolder\": \"John Cassian\",\n    \"cardnumber\": \"4111111111111111\",\n    \"cardzip\": \"12345\",\n    \"initiator\": \"payor\",\n    \"method\": \"card\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}"

response = http.request(request)
puts response.read_body
```

**`Card`**

```java Card
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"cardcvv\": \"999\",\n    \"cardexp\": \"02/27\",\n    \"cardHolder\": \"John Cassian\",\n    \"cardnumber\": \"4111111111111111\",\n    \"cardzip\": \"12345\",\n    \"initiator\": \"payor\",\n    \"method\": \"card\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")
  .asString();
```

**`Card`**

```php Card
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid', [
  'body' => '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "cardcvv": "999",
    "cardexp": "02/27",
    "cardHolder": "John Cassian",
    "cardnumber": "4111111111111111",
    "cardzip": "12345",
    "initiator": "payor",
    "method": "card"
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`Card`**

```csharp Card
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/MoneyIn/getpaid");
var request = new RestRequest(Method.POST);
request.AddHeader("requestToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"cardcvv\": \"999\",\n    \"cardexp\": \"02/27\",\n    \"cardHolder\": \"John Cassian\",\n    \"cardnumber\": \"4111111111111111\",\n    \"cardzip\": \"12345\",\n    \"initiator\": \"payor\",\n    \"method\": \"card\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`Card`**

```swift Card
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "paymentDetails": [
    "totalAmount": 100,
    "serviceFee": 0
  ],
  "paymentMethod": [
    "cardcvv": "999",
    "cardexp": "02/27",
    "cardHolder": "John Cassian",
    "cardnumber": "4111111111111111",
    "cardzip": "12345",
    "initiator": "payor",
    "method": "card"
  ],
  "customerData": ["customerId": 4440],
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/getpaid")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

#### ACH

The ACH payment method is used for ACH payments made with a bank account.

### Request

POST [https://api-sandbox.payabli.com/api/MoneyIn/getpaid](https://api-sandbox.payabli.com/api/MoneyIn/getpaid)

**`ACH`**

```curl ACH
curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
     -H "requestToken: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "achAccount": "123123123",
    "achAccountType": "Checking",
    "achCode": "WEB",
    "achHolder": "John Cassian",
    "achHolderType": "personal",
    "achRouting": "123123123",
    "method": "ach"
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}'
```

**`ACH`**

```python ACH
import requests

url = "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

payload = {
    "paymentDetails": {
        "totalAmount": 100,
        "serviceFee": 0
    },
    "paymentMethod": {
        "achAccount": "123123123",
        "achAccountType": "Checking",
        "achCode": "WEB",
        "achHolder": "John Cassian",
        "achHolderType": "personal",
        "achRouting": "123123123",
        "method": "ach"
    },
    "customerData": { "customerId": 4440 },
    "entryPoint": "f743aed24a",
    "ipaddress": "255.255.255.255"
}
headers = {
    "requestToken": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`ACH`**

```javascript ACH
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid';
const options = {
  method: 'POST',
  headers: {requestToken: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"paymentDetails":{"totalAmount":100,"serviceFee":0},"paymentMethod":{"achAccount":"123123123","achAccountType":"Checking","achCode":"WEB","achHolder":"John Cassian","achHolderType":"personal","achRouting":"123123123","method":"ach"},"customerData":{"customerId":4440},"entryPoint":"f743aed24a","ipaddress":"255.255.255.255"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`ACH`**

```go ACH
package main

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

func main() {

	url := "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

	payload := strings.NewReader("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"achAccount\": \"123123123\",\n    \"achAccountType\": \"Checking\",\n    \"achCode\": \"WEB\",\n    \"achHolder\": \"John Cassian\",\n    \"achHolderType\": \"personal\",\n    \"achRouting\": \"123123123\",\n    \"method\": \"ach\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`ACH`**

```ruby ACH
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"achAccount\": \"123123123\",\n    \"achAccountType\": \"Checking\",\n    \"achCode\": \"WEB\",\n    \"achHolder\": \"John Cassian\",\n    \"achHolderType\": \"personal\",\n    \"achRouting\": \"123123123\",\n    \"method\": \"ach\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}"

response = http.request(request)
puts response.read_body
```

**`ACH`**

```java ACH
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"achAccount\": \"123123123\",\n    \"achAccountType\": \"Checking\",\n    \"achCode\": \"WEB\",\n    \"achHolder\": \"John Cassian\",\n    \"achHolderType\": \"personal\",\n    \"achRouting\": \"123123123\",\n    \"method\": \"ach\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")
  .asString();
```

**`ACH`**

```php ACH
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid', [
  'body' => '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "achAccount": "123123123",
    "achAccountType": "Checking",
    "achCode": "WEB",
    "achHolder": "John Cassian",
    "achHolderType": "personal",
    "achRouting": "123123123",
    "method": "ach"
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`ACH`**

```csharp ACH
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/MoneyIn/getpaid");
var request = new RestRequest(Method.POST);
request.AddHeader("requestToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"achAccount\": \"123123123\",\n    \"achAccountType\": \"Checking\",\n    \"achCode\": \"WEB\",\n    \"achHolder\": \"John Cassian\",\n    \"achHolderType\": \"personal\",\n    \"achRouting\": \"123123123\",\n    \"method\": \"ach\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`ACH`**

```swift ACH
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "paymentDetails": [
    "totalAmount": 100,
    "serviceFee": 0
  ],
  "paymentMethod": [
    "achAccount": "123123123",
    "achAccountType": "Checking",
    "achCode": "WEB",
    "achHolder": "John Cassian",
    "achHolderType": "personal",
    "achRouting": "123123123",
    "method": "ach"
  ],
  "customerData": ["customerId": 4440],
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/getpaid")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

#### Stored Method

The Stored Method payment method is used for payments made with stored methods, either tokenized credit card or tokenized ACH account.

### Request

POST [https://api-sandbox.payabli.com/api/MoneyIn/getpaid](https://api-sandbox.payabli.com/api/MoneyIn/getpaid)

**`StoredMethod`**

```curl StoredMethod
curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
     -H "requestToken: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "initiator": "payor",
    "method": "card",
    "storedMethodId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440",
    "storedMethodUsageType": "unscheduled"
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}'
```

**`StoredMethod`**

```python StoredMethod
import requests

url = "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

payload = {
    "paymentDetails": {
        "totalAmount": 100,
        "serviceFee": 0
    },
    "paymentMethod": {
        "initiator": "payor",
        "method": "card",
        "storedMethodId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440",
        "storedMethodUsageType": "unscheduled"
    },
    "customerData": { "customerId": 4440 },
    "entryPoint": "f743aed24a",
    "ipaddress": "255.255.255.255"
}
headers = {
    "requestToken": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`StoredMethod`**

```javascript StoredMethod
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid';
const options = {
  method: 'POST',
  headers: {requestToken: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"paymentDetails":{"totalAmount":100,"serviceFee":0},"paymentMethod":{"initiator":"payor","method":"card","storedMethodId":"1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440","storedMethodUsageType":"unscheduled"},"customerData":{"customerId":4440},"entryPoint":"f743aed24a","ipaddress":"255.255.255.255"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`StoredMethod`**

```go StoredMethod
package main

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

func main() {

	url := "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

	payload := strings.NewReader("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"initiator\": \"payor\",\n    \"method\": \"card\",\n    \"storedMethodId\": \"1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440\",\n    \"storedMethodUsageType\": \"unscheduled\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`StoredMethod`**

```ruby StoredMethod
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"initiator\": \"payor\",\n    \"method\": \"card\",\n    \"storedMethodId\": \"1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440\",\n    \"storedMethodUsageType\": \"unscheduled\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}"

response = http.request(request)
puts response.read_body
```

**`StoredMethod`**

```java StoredMethod
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"initiator\": \"payor\",\n    \"method\": \"card\",\n    \"storedMethodId\": \"1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440\",\n    \"storedMethodUsageType\": \"unscheduled\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")
  .asString();
```

**`StoredMethod`**

```php StoredMethod
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid', [
  'body' => '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "initiator": "payor",
    "method": "card",
    "storedMethodId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440",
    "storedMethodUsageType": "unscheduled"
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`StoredMethod`**

```csharp StoredMethod
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/MoneyIn/getpaid");
var request = new RestRequest(Method.POST);
request.AddHeader("requestToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"initiator\": \"payor\",\n    \"method\": \"card\",\n    \"storedMethodId\": \"1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440\",\n    \"storedMethodUsageType\": \"unscheduled\"\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`StoredMethod`**

```swift StoredMethod
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "paymentDetails": [
    "totalAmount": 100,
    "serviceFee": 0
  ],
  "paymentMethod": [
    "initiator": "payor",
    "method": "card",
    "storedMethodId": "1ec55af9-7b5a-4ff0-81ed-c12d2f95e135-4440",
    "storedMethodUsageType": "unscheduled"
  ],
  "customerData": ["customerId": 4440],
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/getpaid")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

#### Cloud

The Cloud payment method is used for payments made with Cloud devices (payment terminals).

### Request

POST [https://api-sandbox.payabli.com/api/MoneyIn/getpaid](https://api-sandbox.payabli.com/api/MoneyIn/getpaid)

**`Cloud`**

```curl Cloud
curl -X POST https://api-sandbox.payabli.com/api/MoneyIn/getpaid \
     -H "requestToken: <apiKey>" \
     -H "Content-Type: application/json" \
     -d '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "device": "6c361c7d-674c-44cc-b790-382b75d1xxx",
    "method": "cloud",
    "saveIfSuccess": true
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}'
```

**`Cloud`**

```python Cloud
import requests

url = "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

payload = {
    "paymentDetails": {
        "totalAmount": 100,
        "serviceFee": 0
    },
    "paymentMethod": {
        "device": "6c361c7d-674c-44cc-b790-382b75d1xxx",
        "method": "cloud",
        "saveIfSuccess": True
    },
    "customerData": { "customerId": 4440 },
    "entryPoint": "f743aed24a",
    "ipaddress": "255.255.255.255"
}
headers = {
    "requestToken": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

**`Cloud`**

```javascript Cloud
const url = 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid';
const options = {
  method: 'POST',
  headers: {requestToken: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"paymentDetails":{"totalAmount":100,"serviceFee":0},"paymentMethod":{"device":"6c361c7d-674c-44cc-b790-382b75d1xxx","method":"cloud","saveIfSuccess":true},"customerData":{"customerId":4440},"entryPoint":"f743aed24a","ipaddress":"255.255.255.255"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**`Cloud`**

```go Cloud
package main

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

func main() {

	url := "https://api-sandbox.payabli.com/api/MoneyIn/getpaid"

	payload := strings.NewReader("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"device\": \"6c361c7d-674c-44cc-b790-382b75d1xxx\",\n    \"method\": \"cloud\",\n    \"saveIfSuccess\": true\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("requestToken", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

**`Cloud`**

```ruby Cloud
require 'uri'
require 'net/http'

url = URI("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["requestToken"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"device\": \"6c361c7d-674c-44cc-b790-382b75d1xxx\",\n    \"method\": \"cloud\",\n    \"saveIfSuccess\": true\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}"

response = http.request(request)
puts response.read_body
```

**`Cloud`**

```java Cloud
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyIn/getpaid")
  .header("requestToken", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"device\": \"6c361c7d-674c-44cc-b790-382b75d1xxx\",\n    \"method\": \"cloud\",\n    \"saveIfSuccess\": true\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}")
  .asString();
```

**`Cloud`**

```php Cloud
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api-sandbox.payabli.com/api/MoneyIn/getpaid', [
  'body' => '{
  "paymentDetails": {
    "totalAmount": 100,
    "serviceFee": 0
  },
  "paymentMethod": {
    "device": "6c361c7d-674c-44cc-b790-382b75d1xxx",
    "method": "cloud",
    "saveIfSuccess": true
  },
  "customerData": {
    "customerId": 4440
  },
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'requestToken' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

**`Cloud`**

```csharp Cloud
using RestSharp;

var client = new RestClient("https://api-sandbox.payabli.com/api/MoneyIn/getpaid");
var request = new RestRequest(Method.POST);
request.AddHeader("requestToken", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"paymentDetails\": {\n    \"totalAmount\": 100,\n    \"serviceFee\": 0\n  },\n  \"paymentMethod\": {\n    \"device\": \"6c361c7d-674c-44cc-b790-382b75d1xxx\",\n    \"method\": \"cloud\",\n    \"saveIfSuccess\": true\n  },\n  \"customerData\": {\n    \"customerId\": 4440\n  },\n  \"entryPoint\": \"f743aed24a\",\n  \"ipaddress\": \"255.255.255.255\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

**`Cloud`**

```swift Cloud
import Foundation

let headers = [
  "requestToken": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "paymentDetails": [
    "totalAmount": 100,
    "serviceFee": 0
  ],
  "paymentMethod": [
    "device": "6c361c7d-674c-44cc-b790-382b75d1xxx",
    "method": "cloud",
    "saveIfSuccess": true
  ],
  "customerData": ["customerId": 4440],
  "entryPoint": "f743aed24a",
  "ipaddress": "255.255.255.255"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/getpaid")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

A successful request returns a 200 response with a JSON body. The transaction ID is returned as `referenceId`, this is used as the `transId` in other endpoints.

> **Tip**
>
> You can use the DeclinedPayment notification to get alerts for declined transactions, including both declined credit cards and declined ACH transactions. See [Notifications and Webhooks Overview](/developer-guides/notifications-and-webhooks-overview) for more.

### Response (200)

```json
{
  "isSuccess": true,
  "responseData": {
    "AuthCode": "AuthCode",
    "avsResponseText": "No address or ZIP match only",
    "CustomerId": 4440,
    "cvvResponseText": "CVV2/CVC2 no match",
    "methodReferenceId": null,
    "ReferenceId": "45-erre-324",
    "ResultCode": 1,
    "ResultText": "Approved"
  },
  "responseText": "Success"
}
```

If the payment is declined, the `responseText` reads `Declined`, and `resultText` contains the reason for the decline.

**`Decline example`**

```json Decline example {10,12}
  {
    "isSuccess": false,
    "responseData": {
      "AuthCode": "null",
      "avsResponseText": "No address or ZIP match only",
      "CustomerId": 4440,
      "cvvResponseText": "CVV2/CVC2 no match",
      "ReferenceId": "45-erre-324",
      "ResultCode": 1,
      "ResultText": "200: Transaction was declined by processor.. DECLINE"
    },
    "responseText": "Declined"
  }
```

## Next steps

You can view transactions in the UI in your PayHub or PartnerHub account, or you can get lists of transactions via the API for [paypoints](/api-reference/query/get-list-of-transactions-for-an-entrypoint) or [organizations](/api-reference/query/get-list-of-transactions-for-an-organization)