Skip to main content
POST
/
points_transactions
Create a points transaction
curl --request POST \
  --url https://api.smile.io/v1/points_transactions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "points_transaction": {
    "customer_id": 304169228,
    "points_change": 100,
    "description": "Points correction",
    "internal_note": "Due to issue with order #6834"
  }
}
'
package main

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

func main() {

	url := "https://api.smile.io/v1/points_transactions"

	payload := strings.NewReader("{\n  \"points_transaction\": {\n    \"customer_id\": 304169228,\n    \"points_change\": 100,\n    \"description\": \"Points correction\",\n    \"internal_note\": \"Due to issue with order #6834\"\n  }\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

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

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

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.smile.io/v1/points_transactions")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"points_transaction\": {\n    \"customer_id\": 304169228,\n    \"points_change\": 100,\n    \"description\": \"Points correction\",\n    \"internal_note\": \"Due to issue with order #6834\"\n  }\n}")
  .asString();
const url = 'https://api.smile.io/v1/points_transactions';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    points_transaction: {
      customer_id: 304169228,
      points_change: 100,
      description: 'Points correction',
      internal_note: 'Due to issue with order #6834'
    }
  })
};

fetch(url, options)
  .then(res => res.json())
  .then(json => console.log(json))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.smile.io/v1/points_transactions",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'points_transaction' => [
        'customer_id' => 304169228,
        'points_change' => 100,
        'description' => 'Points correction',
        'internal_note' => 'Due to issue with order #6834'
    ]
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
$headers=@{}
$headers.Add("Authorization", "Bearer <token>")
$headers.Add("Content-Type", "application/json")
$response = Invoke-WebRequest -Uri 'https://api.smile.io/v1/points_transactions' -Method POST -Headers $headers -ContentType 'application/json' -Body '{
  "points_transaction": {
    "customer_id": 304169228,
    "points_change": 100,
    "description": "Points correction",
    "internal_note": "Due to issue with order #6834"
  }
}'
import requests

url = "https://api.smile.io/v1/points_transactions"

payload = { "points_transaction": {
        "customer_id": 304169228,
        "points_change": 100,
        "description": "Points correction",
        "internal_note": "Due to issue with order #6834"
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)
require 'uri'
require 'net/http'

url = URI("https://api.smile.io/v1/points_transactions")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"points_transaction\": {\n    \"customer_id\": 304169228,\n    \"points_change\": 100,\n    \"description\": \"Points correction\",\n    \"internal_note\": \"Due to issue with order #6834\"\n  }\n}"

response = http.request(request)
puts response.read_body
{
  "points_transaction": {
    "id": 825673452,
    "customer_id": 304169228,
    "points_change": 100,
    "description": "Points correction",
    "internal_note": "Due to issue with order #6834",
    "created_at": "2024-12-07T20:15:27.893Z",
    "updated_at": "2024-12-07T20:15:27.893Z"
  }
}
This endpoint requires the scope.
Points transactions that would result in a negative points balance will be rejected. To issue points as a reward for completing an action, use the create an activity endpoint instead.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
points_transaction
object
required

Response

201 - application/json

The points transaction was successfully created.

points_transaction
object