cURL
curl --request POST \
--url https://us.api.flexprice.io/v1/payments \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"currency": "<string>",
"destination_id": "<string>",
"amount": "<string>",
"cancel_url": "<string>",
"gateway_options": {
"razorpay": {
"notify_customer": true
},
"stripe": {
"allow_promotion_codes": true,
"tax_id_collection_enabled": true
}
},
"idempotency_key": "<string>",
"metadata": {},
"payment_method_id": "<string>",
"process_payment": true,
"save_card_and_make_default": false,
"success_url": "<string>"
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.payments.create_payment(currency="Uganda Shilling", destination_id="<id>", destination_type="CUSTOMER", payment_method_type="CREDITS", process_payment=True, save_card_and_make_default=False)
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.payments.createPayment({
currency: "Uganda Shilling",
destinationId: "<id>",
destinationType: "CUSTOMER",
paymentMethodType: "CREDITS",
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Payments.CreatePayment(ctx, types.CreatePaymentRequest{
Currency: "Uganda Shilling",
DestinationID: "<id>",
DestinationType: types.PaymentDestinationTypeCustomer,
PaymentMethodType: types.PaymentMethodTypeCredits,
})
if err != nil {
log.Fatal(err)
}
if res.PaymentResponse != nil {
// handle response
}
}{
"amount": "<string>",
"attempts": [
{
"attempt_number": 123,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"error": {
"code": "<string>",
"reason": "<string>",
"source": "<string>",
"step": "<string>"
},
"error_message": "<string>",
"gateway_attempt_id": "<string>",
"id": "<string>",
"payment_id": "<string>",
"payment_method": {
"bank": {
"account_type": "<string>",
"auth_type": "<string>",
"bank": "<string>",
"ifsc": "<string>",
"last4": "<string>"
},
"card": {
"brand": "<string>",
"exp_month": 123,
"exp_year": 123,
"fingerprint": "<string>",
"funding": "<string>",
"issuer": "<string>",
"last4": "<string>"
},
"type": "CARD",
"wallet": {
"provider": "<string>"
}
},
"payment_status": "INITIATED",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"connection_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"destination_id": "<string>",
"destination_type": "INVOICE",
"environment_id": "<string>",
"error_message": "<string>",
"failed_at": "2023-11-07T05:31:56Z",
"gateway_metadata": {},
"gateway_payment_id": "<string>",
"gateway_tracking_id": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"invoice_number": "<string>",
"metadata": {},
"payment_gateway": "<string>",
"payment_method_id": "<string>",
"payment_method_type": "CARD",
"payment_status": "INITIATED",
"payment_url": "<string>",
"refunded_at": "2023-11-07T05:31:56Z",
"save_card_and_make_default": true,
"submitted_for_processing": true,
"succeeded_at": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"track_attempts": true,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"voided_at": "2023-11-07T05:31:56Z"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Payments
Create payment
Use when recording a payment against an invoice (e.g. after receiving funds via a gateway or manual entry).
POST
/
payments
cURL
curl --request POST \
--url https://us.api.flexprice.io/v1/payments \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"currency": "<string>",
"destination_id": "<string>",
"amount": "<string>",
"cancel_url": "<string>",
"gateway_options": {
"razorpay": {
"notify_customer": true
},
"stripe": {
"allow_promotion_codes": true,
"tax_id_collection_enabled": true
}
},
"idempotency_key": "<string>",
"metadata": {},
"payment_method_id": "<string>",
"process_payment": true,
"save_card_and_make_default": false,
"success_url": "<string>"
}
'from flexprice import Flexprice
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.payments.create_payment(currency="Uganda Shilling", destination_id="<id>", destination_type="CUSTOMER", payment_method_type="CREDITS", process_payment=True, save_card_and_make_default=False)
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.payments.createPayment({
currency: "Uganda Shilling",
destinationId: "<id>",
destinationType: "CUSTOMER",
paymentMethodType: "CREDITS",
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Payments.CreatePayment(ctx, types.CreatePaymentRequest{
Currency: "Uganda Shilling",
DestinationID: "<id>",
DestinationType: types.PaymentDestinationTypeCustomer,
PaymentMethodType: types.PaymentMethodTypeCredits,
})
if err != nil {
log.Fatal(err)
}
if res.PaymentResponse != nil {
// handle response
}
}{
"amount": "<string>",
"attempts": [
{
"attempt_number": 123,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"error": {
"code": "<string>",
"reason": "<string>",
"source": "<string>",
"step": "<string>"
},
"error_message": "<string>",
"gateway_attempt_id": "<string>",
"id": "<string>",
"payment_id": "<string>",
"payment_method": {
"bank": {
"account_type": "<string>",
"auth_type": "<string>",
"bank": "<string>",
"ifsc": "<string>",
"last4": "<string>"
},
"card": {
"brand": "<string>",
"exp_month": 123,
"exp_year": 123,
"fingerprint": "<string>",
"funding": "<string>",
"issuer": "<string>",
"last4": "<string>"
},
"type": "CARD",
"wallet": {
"provider": "<string>"
}
},
"payment_status": "INITIATED",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"connection_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"destination_id": "<string>",
"destination_type": "INVOICE",
"environment_id": "<string>",
"error_message": "<string>",
"failed_at": "2023-11-07T05:31:56Z",
"gateway_metadata": {},
"gateway_payment_id": "<string>",
"gateway_tracking_id": "<string>",
"id": "<string>",
"idempotency_key": "<string>",
"invoice_number": "<string>",
"metadata": {},
"payment_gateway": "<string>",
"payment_method_id": "<string>",
"payment_method_type": "CARD",
"payment_status": "INITIATED",
"payment_url": "<string>",
"refunded_at": "2023-11-07T05:31:56Z",
"save_card_and_make_default": true,
"submitted_for_processing": true,
"succeeded_at": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"track_attempts": true,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"voided_at": "2023-11-07T05:31:56Z"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Body
application/json
Payment configuration
Response
Created payment

