cURL
curl -X POST "$EXSITED_BASE_URL/api/v4/purchase_credit_notes/pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b/apply" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"purchase_credit_note": {
"purchase_invoices": [
{
"purchase_invoice_id": "PI-0001",
"amount": "1.00"
}
]
}
}'from exsited import build_client
client = build_client()
response = client.purchase_credit_notes.apply_purchase_credit_note(
"pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
{
"purchase_credit_note": {
"purchase_invoices": [{"purchase_invoice_id": "PI-0001", "amount": "1.00"}]
}
},
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.purchaseCreditNotes.applyPurchaseCreditNote('pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b', {
purchase_credit_note: {purchase_invoices: [{purchase_invoice_id: 'PI-0001', amount: '1.00'}]},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->purchaseCreditNotes->applyPurchaseCreditNote(
'pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b',
[
'purchase_credit_note' => [
'purchase_invoices' => [['purchase_invoice_id' => 'PI-0001', 'amount' => '1.00']],
],
],
);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.purchase_credit_notes.purchase_credit_notes_dto.PurchaseCreditNotesDto.PurchaseCreditNoteCreated;
import java.util.List;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<PurchaseCreditNoteCreated> response = client.purchaseCreditNotes().applyPurchaseCreditNote(
"pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
Map.of(
"purchase_credit_note", Map.of(
"purchase_invoices", List.of(
Map.of("purchase_invoice_id", "PI-0001", "amount", "1.00")))));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.PurchaseCreditNotes.ApplyPurchaseCreditNoteAsync(
"pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
new Dictionary<string, object?>
{
["purchase_credit_note"] = new Dictionary<string, object?>
{
["purchase_invoices"] = new List<object?>
{
new Dictionary<string, object?>
{
["purchase_invoice_id"] = "PI-0001",
["amount"] = "1.00",
},
},
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.purchaseCreditNotes.applyPurchaseCreditNote(
'pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b',
{
'purchase_credit_note': {
'purchase_invoices': [
{'purchase_invoice_id': 'PI-0001', 'amount': '1.00'},
],
},
},
);
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.PurchaseCreditNotes().ApplyPurchaseCreditNote(context.Background(), "pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b", map[string]any{
"purchase_credit_note": map[string]any{
"purchase_invoices": []any{
map[string]any{
"purchase_invoice_id": "PI-0001",
"amount": "1.00",
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"purchase_credit_note": {
"activity_logs": [
"<unknown>"
],
"code": "<string>",
"href": "<string>",
"id": "<string>",
"initial_amount": "<string>",
"issue_date": "<string>",
"object": "<string>",
"remaining_amount": "<string>",
"status": {
"key": "<string>",
"value": "<string>"
},
"version": 123
}
}{
"object": "<string>",
"request_id": "<string>",
"status": 123,
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>"
}
]
}Purchase credit notes
Apply a purchase credit note to purchase invoices
Spends a purchase credit note on one or more purchase invoices and returns the credit note under purchase_credit_note.
POST
/
purchase_credit_notes
/
{purchase_credit_note_id}
/
apply
cURL
curl -X POST "$EXSITED_BASE_URL/api/v4/purchase_credit_notes/pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b/apply" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"purchase_credit_note": {
"purchase_invoices": [
{
"purchase_invoice_id": "PI-0001",
"amount": "1.00"
}
]
}
}'from exsited import build_client
client = build_client()
response = client.purchase_credit_notes.apply_purchase_credit_note(
"pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
{
"purchase_credit_note": {
"purchase_invoices": [{"purchase_invoice_id": "PI-0001", "amount": "1.00"}]
}
},
)
print(response.data)
import {buildClient} from 'exsited';
const client = await buildClient();
const response = await client.purchaseCreditNotes.applyPurchaseCreditNote('pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b', {
purchase_credit_note: {purchase_invoices: [{purchase_invoice_id: 'PI-0001', amount: '1.00'}]},
});
console.log(response.data);
use Exsited\Client\ClientRegistry;
$client = ClientRegistry::buildClient();
$response = $client->purchaseCreditNotes->applyPurchaseCreditNote(
'pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b',
[
'purchase_credit_note' => [
'purchase_invoices' => [['purchase_invoice_id' => 'PI-0001', 'amount' => '1.00']],
],
],
);
print_r($response->data);
import com.exsited.client.ApiResponse;
import com.exsited.client.ClientRegistry;
import com.exsited.client.ExsitedClient;
import com.exsited.resources.purchase_credit_notes.purchase_credit_notes_dto.PurchaseCreditNotesDto.PurchaseCreditNoteCreated;
import java.util.List;
import java.util.Map;
ExsitedClient client = ClientRegistry.buildClient();
ApiResponse<PurchaseCreditNoteCreated> response = client.purchaseCreditNotes().applyPurchaseCreditNote(
"pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
Map.of(
"purchase_credit_note", Map.of(
"purchase_invoices", List.of(
Map.of("purchase_invoice_id", "PI-0001", "amount", "1.00")))));
System.out.println(response.getMap());
using Exsited.Client;
await using var client = ExsitedClient.BuildClient();
var response = await client.PurchaseCreditNotes.ApplyPurchaseCreditNoteAsync(
"pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b",
new Dictionary<string, object?>
{
["purchase_credit_note"] = new Dictionary<string, object?>
{
["purchase_invoices"] = new List<object?>
{
new Dictionary<string, object?>
{
["purchase_invoice_id"] = "PI-0001",
["amount"] = "1.00",
},
},
},
});
Console.WriteLine(response.Json);
import 'package:exsited/exsited.dart';
final client = buildClient();
final response = await client.purchaseCreditNotes.applyPurchaseCreditNote(
'pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b',
{
'purchase_credit_note': {
'purchase_invoices': [
{'purchase_invoice_id': 'PI-0001', 'amount': '1.00'},
],
},
},
);
print(response.map);
import (
"context"
"fmt"
"log"
exsited "github.com/exsited/exsited-sdk-go/v4"
)
client, err := exsited.BuildClient(nil)
if err != nil {
log.Fatal(err)
}
defer client.Close()
response, err := client.PurchaseCreditNotes().ApplyPurchaseCreditNote(context.Background(), "pcn_5e4d3c2b1a0f4e9d8c7b6a5f4e3d2c1b", map[string]any{
"purchase_credit_note": map[string]any{
"purchase_invoices": []any{
map[string]any{
"purchase_invoice_id": "PI-0001",
"amount": "1.00",
},
},
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Map)
{
"purchase_credit_note": {
"activity_logs": [
"<unknown>"
],
"code": "<string>",
"href": "<string>",
"id": "<string>",
"initial_amount": "<string>",
"issue_date": "<string>",
"object": "<string>",
"remaining_amount": "<string>",
"status": {
"key": "<string>",
"value": "<string>"
},
"version": 123
}
}{
"object": "<string>",
"request_id": "<string>",
"status": 123,
"code": "<string>",
"message": "<string>",
"doc_url": "<string>",
"errors": [
{
"field": "<string>",
"code": "<string>",
"message": "<string>",
"doc_url": "<string>"
}
]
}Applies the credit to purchase invoices, listed under
purchase_credit_note.purchase_invoices. Each entry takes purchase_invoice_id and amount and nothing else. Applying the credit records a purchase payment. Address the credit note by its pcn_ id.
Applying the credit records a purchase payment.
The SDK samples get their client from credentials your app registers once when it starts, as shown in Authentication. To try the call here, click Try it, set
host to your Exsited API host name and paste an access token from Get an access token. To send a raw JSON body instead of filling in fields, copy the cURL sample and edit its -d payload.Authorizations
An access token from POST /api/v4/oauth2/token. The SDKs get and renew it for you.
Path Parameters
The purchase credit note's pcn_ id. A code returns 400.
Body
application/json
Show child attributes
Show child attributes
Response
The purchase credit note, under purchase_credit_note.
Show child attributes
Show child attributes