API Reference
Integration Guide
Payment Operations
- Core Operations
- Advanced Features
Schemas & Webhooks
Payments - Create
Use this API to initiate a payment.
When you create a payment, it is stored with GreenBanana. At this stage, the payment intent is generated but requires confirmation from either the user or merchant to proceed.
Once confirmed (by including confirm=true and payment_method), the request is sent to the selected BNPL provider to verify if the customer is eligible for credit to proceed with the Buy Now, Pay Later (BNPL) provider.
The following request body example demonstrates how to create a payment with GreenBanana, which can be processed through any BNPL provider.
Note: The metadata
field is used to carry additional information required by the BNPL provider. We have compiled all necessary metadata fields to ensure compatibility with any BNPL provider.
curl --request POST \
--url https://api.staging.bnplx.io/payments \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '{
"amount": 9999,
"billing": {
"address": {
"city": "Frankfurt",
"country": "DE",
"first_name": "John",
"last_name": "Doe",
"line1": "1427",
"line2": "Harrison St",
"line3": "Harrison St",
"state": "Hesse",
"zip": "22100"
},
"email": "guest@example.com",
"phone": {
"country_code": "+91",
"number": "8056594427"
}
},
"capture_method": "manual_multiple",
"currency": "EUR",
"metadata": {
"birth_date": "2001-10-19",
"buyer_type": "private_person",
"customer_locale": "en-US",
"device_token": "abcddef",
"gender": "M",
"order_dttm": "2028-10-01 10:10:10.222",
"settlement": "settlement1234"
},
"order_details": [
{
"account_name": "transaction_processing",
"amount": 6510,
"product_name": "Apple iphone 15",
"quantity": 1
}
],
"shipping": {
"address": {
"city": "Frankfurt",
"country": "DE",
"first_name": "John",
"last_name": "Doe",
"line1": "1427",
"line2": "Harrison St",
"line3": "Harrison St",
"state": "Hesse",
"zip": "22100"
},
"email": "guest@example.com",
"phone": {
"country_code": "+91",
"number": "8056594427"
}
}
}'
{
"allowed_payment_method_types": null,
"amount": 9999,
"amount_capturable": 0,
"amount_received": null,
"attempt_count": 1,
"authentication_type": null,
"authorization_count": null,
"billing": null,
"browser_info": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"cancellation_reason": null,
"capture_id": null,
"capture_method": "manual_multiple",
"capture_on": null,
"charges": null,
"client_secret": "pay_TCgoS5VirsLaTdpVRhyf_secret_HiWDQepqFRgBxajQfsp0",
"connector": null,
"connector_capture_id": null,
"connector_label": null,
"connector_metadata": null,
"connector_transaction_id": null,
"created": "2024-11-11T09:12:36.076Z",
"currency": "EUR",
"customer": null,
"customer_id": null,
"description": null,
"disputes": null,
"email": null,
"ephemeral_key": null,
"error_code": null,
"error_message": null,
"expires_on": "2024-11-11T09:27:36.076Z",
"external_3ds_authentication_attempted": false,
"external_authentication_details": null,
"feature_metadata": null,
"fingerprint": null,
"frm_message": null,
"frm_metadata": null,
"incremental_authorization_allowed": null,
"incremental_authorizations": null,
"mandate_data": null,
"mandate_id": null,
"manual_retry_allowed": null,
"merchant_connector_id": null,
"merchant_decision": null,
"merchant_id": "merchant_test",
"merchant_order_reference_id": null,
"metadata": null,
"name": null,
"net_amount": 9999,
"next_action": null,
"off_session": null,
"order_details": [
{
"amount": 10,
"brand": null,
"category": "GOODS",
"product_id": "blabla",
"product_img_link": null,
"product_link": null,
"product_name": "Apple iphone 15",
"product_type": null,
"quantity": 1,
"requires_shipping": null,
"sub_category": null
}
],
"payment_experience": null,
"payment_id": "pay_TCgoS5VirsLaTdpVRhyf",
"payment_link": null,
"payment_method": null,
"payment_method_data": null,
"payment_method_id": null,
"payment_method_status": null,
"payment_method_type": null,
"payment_token": null,
"phone": null,
"profile_id": "pro_RFKnswEGV8pB0SCa7RZ6",
"reference_id": null,
"refunds": null,
"return_url": null,
"setup_future_usage": null,
"shipping": null,
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"status": "requires_payment_method",
"surcharge_details": null,
"unified_code": null,
"unified_message": null,
"updated": "2024-11-11T09:12:36.161Z"
}
Authorizations
Use the API key created under your merchant account from the GreenBanana dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.
Body
Response
The response is of type object
.
curl --request POST \
--url https://api.staging.bnplx.io/payments \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '{
"amount": 9999,
"billing": {
"address": {
"city": "Frankfurt",
"country": "DE",
"first_name": "John",
"last_name": "Doe",
"line1": "1427",
"line2": "Harrison St",
"line3": "Harrison St",
"state": "Hesse",
"zip": "22100"
},
"email": "guest@example.com",
"phone": {
"country_code": "+91",
"number": "8056594427"
}
},
"capture_method": "manual_multiple",
"currency": "EUR",
"metadata": {
"birth_date": "2001-10-19",
"buyer_type": "private_person",
"customer_locale": "en-US",
"device_token": "abcddef",
"gender": "M",
"order_dttm": "2028-10-01 10:10:10.222",
"settlement": "settlement1234"
},
"order_details": [
{
"account_name": "transaction_processing",
"amount": 6510,
"product_name": "Apple iphone 15",
"quantity": 1
}
],
"shipping": {
"address": {
"city": "Frankfurt",
"country": "DE",
"first_name": "John",
"last_name": "Doe",
"line1": "1427",
"line2": "Harrison St",
"line3": "Harrison St",
"state": "Hesse",
"zip": "22100"
},
"email": "guest@example.com",
"phone": {
"country_code": "+91",
"number": "8056594427"
}
}
}'
{
"allowed_payment_method_types": null,
"amount": 9999,
"amount_capturable": 0,
"amount_received": null,
"attempt_count": 1,
"authentication_type": null,
"authorization_count": null,
"billing": null,
"browser_info": null,
"business_country": null,
"business_label": "default",
"business_sub_label": null,
"cancellation_reason": null,
"capture_id": null,
"capture_method": "manual_multiple",
"capture_on": null,
"charges": null,
"client_secret": "pay_TCgoS5VirsLaTdpVRhyf_secret_HiWDQepqFRgBxajQfsp0",
"connector": null,
"connector_capture_id": null,
"connector_label": null,
"connector_metadata": null,
"connector_transaction_id": null,
"created": "2024-11-11T09:12:36.076Z",
"currency": "EUR",
"customer": null,
"customer_id": null,
"description": null,
"disputes": null,
"email": null,
"ephemeral_key": null,
"error_code": null,
"error_message": null,
"expires_on": "2024-11-11T09:27:36.076Z",
"external_3ds_authentication_attempted": false,
"external_authentication_details": null,
"feature_metadata": null,
"fingerprint": null,
"frm_message": null,
"frm_metadata": null,
"incremental_authorization_allowed": null,
"incremental_authorizations": null,
"mandate_data": null,
"mandate_id": null,
"manual_retry_allowed": null,
"merchant_connector_id": null,
"merchant_decision": null,
"merchant_id": "merchant_test",
"merchant_order_reference_id": null,
"metadata": null,
"name": null,
"net_amount": 9999,
"next_action": null,
"off_session": null,
"order_details": [
{
"amount": 10,
"brand": null,
"category": "GOODS",
"product_id": "blabla",
"product_img_link": null,
"product_link": null,
"product_name": "Apple iphone 15",
"product_type": null,
"quantity": 1,
"requires_shipping": null,
"sub_category": null
}
],
"payment_experience": null,
"payment_id": "pay_TCgoS5VirsLaTdpVRhyf",
"payment_link": null,
"payment_method": null,
"payment_method_data": null,
"payment_method_id": null,
"payment_method_status": null,
"payment_method_type": null,
"payment_token": null,
"phone": null,
"profile_id": "pro_RFKnswEGV8pB0SCa7RZ6",
"reference_id": null,
"refunds": null,
"return_url": null,
"setup_future_usage": null,
"shipping": null,
"statement_descriptor_name": null,
"statement_descriptor_suffix": null,
"status": "requires_payment_method",
"surcharge_details": null,
"unified_code": null,
"unified_message": null,
"updated": "2024-11-11T09:12:36.161Z"
}