Skip to content

Latest commit

 

History

History
209 lines (175 loc) · 7.08 KB

Refunds.md

File metadata and controls

209 lines (175 loc) · 7.08 KB

Refunds

Method HTTP request Description
PGOrderCreateRefund Post /orders/{order_id}/refunds Create Refund
PGOrderFetchRefund Get /orders/{order_id}/refunds/{refund_id} Get Refund
PGOrderFetchRefunds Get /orders/{order_id}/refunds Get All Refunds for an Order

PGOrderCreateRefund

PGOrderCreateRefund(xApiVersion *string, orderId string, orderCreateRefundRequest *OrderCreateRefundRequest, xRequestId *string, xIdempotencyKey *string, httpClient *http.Client) (*RefundEntity, *http.Response, error)

Create Refund (Docs)

Example

version := "2022-09-01"
refundRequest := cashfree.OrderCreateRefundRequest{
	RefundAmount: 1.0,
	RefundId:     "refund_id_0101",
}
refundEntity, httpResponse, err := cashfree.PGOrderCreateRefund(&version, "order_342bAHtHiGpa2XePHbvRdu22S7p8U", &refundRequest, nil, nil, nil)
if err != nil {
	fmt.Print(err.Error())
} else {
	fmt.Println(httpResponse.StatusCode)
	fmt.Println(refundEntity)
}

Parameters

Name Type Description Notes
orderId string* The id which uniquely identifies your order
xApiVersion string* API version to be used. Format is in YYYY-MM-DD [default to "2022-09-01"]
orderCreateRefundRequest OrderCreateRefundRequest* Request Body to Create Refunds
xRequestId string Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree

OrderCreateRefundRequest

Name Type Description Example
refund_amount double* Amount to be refunded. Should be lesser than or equal to the transaction amount. (Decimals allowed) 1.0
refund_id string* An unique ID to associate the refund with. Provie alphanumeric values refund_id_1888
refund_note string A refund note for your reference. Initiating a refund from Node SDK
refund_speed string Speed at which the refund is processed. It's an optional field with default being STANDARD STANDARD or INSTANT
refund_splits object[] If at all the refund has to be split between multiple vendors

RefundSplits

Name Type Description Example
vendor_id string Vendor id created in Cashfree system vendor_01
amount double Amount which will be associated with this vendor 1.0
percentage double Percentage of order amount which shall get added to vendor account 25

Response

{
  "cf_payment_id": 2388816360,
  "cf_refund_id": "refund_40564529",
  "created_at": "2024-01-11T16:58:06+05:30",
  "entity": "refund",
  "metadata": null,
  "order_id": "order_145082ao5HaUJOvfXKfdQwZ3A1jy5Pq8",
  "processed_at": null,
  "refund_amount": 1,
  "refund_arn": null,
  "refund_charge": 0,
  "refund_currency": "INR",
  "refund_id": "refund_145082ao5HaUJOvfXKfdQwZ3A1jy5Pq8",
  "refund_mode": null,
  "refund_note": null,
  "refund_speed": {
    "requested": "STANDARD",
    "accepted": "STANDARD",
    "processed": null,
    "message": null
  },
  "refund_splits": [],
  "refund_status": "PENDING",
  "refund_type": "MERCHANT_INITIATED",
  "status_description": "In Progress"
}

PGOrderFetchRefund

PGOrderFetchRefund(xApiVersion *string, orderId string, refundId string, xRequestId *string, xIdempotencyKey *string, httpClient *http.Client) (*RefundEntity, *http.Response, error)

Get Refund (Docs)

Example

version := "2022-09-01"
refundEntity, httpResponse, err := cashfree.PGOrderFetchRefund(&version, "order_342bAHtHiGpa2XePHbvRdu22S7p8U", "refund_id_0101", nil, nil, nil)
if err != nil {
	fmt.Print(err.Error())
} else {
	fmt.Println(httpResponse.StatusCode)
	fmt.Println(refundEntity)
}

Parameters

Name Type Description Notes
orderId string The id which uniquely identifies your order
refundId string Refund Id of the refund you want to fetch.
xApiVersion string API version to be used. Format is in YYYY-MM-DD [default to "2022-09-01"]
xRequestId string Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree

Response

{
  "cf_payment_id": 2388816360,
  "cf_refund_id": "refund_40564529",
  "created_at": "2024-01-11T16:58:06+05:30",
  "entity": "refund",
  "metadata": null,
  "order_id": "order_145082ao5HaUJOvfXKfdQwZ3A1jy5Pq8",
  "processed_at": null,
  "refund_amount": 1,
  "refund_arn": null,
  "refund_charge": 0,
  "refund_currency": "INR",
  "refund_id": "refund_145082ao5HaUJOvfXKfdQwZ3A1jy5Pq8",
  "refund_mode": null,
  "refund_note": null,
  "refund_speed": {
    "requested": "STANDARD",
    "accepted": "STANDARD",
    "processed": null,
    "message": null
  },
  "refund_splits": [],
  "refund_status": "PENDING",
  "refund_type": "MERCHANT_INITIATED",
  "status_description": "In Progress"
}

PGOrderFetchRefunds

PGOrderFetchRefunds(xApiVersion *string, orderId string, xRequestId *string, xIdempotencyKey *string, httpClient *http.Client) ([]RefundEntity, *http.Response, error)

Get All Refunds for an Order (Docs)

Example

version := "2022-09-01"
refundEntity, httpResponse, err := cashfree.PGOrderFetchRefunds(&version, "order_342bAHtHiGpa2XePHbvRdu22S7p8U", nil, nil, nil)
if err != nil {
	fmt.Print(err.Error())
} else {
	fmt.Println(httpResponse.StatusCode)
	fmt.Println(refundEntity)
}

Parameters

Name Type Description Notes
orderId string The id which uniquely identifies your order
xApiVersion string API version to be used. Format is in YYYY-MM-DD [default to "2022-09-01"]
xRequestId string Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree

Response

[
  {
  "cf_payment_id": 2388816360,
  "cf_refund_id": "refund_40564529",
  "created_at": "2024-01-11T16:58:06+05:30",
  "entity": "refund",
  "metadata": null,
  "order_id": "order_145082ao5HaUJOvfXKfdQwZ3A1jy5Pq8",
  "processed_at": null,
  "refund_amount": 1,
  "refund_arn": null,
  "refund_charge": 0,
  "refund_currency": "INR",
  "refund_id": "refund_145082ao5HaUJOvfXKfdQwZ3A1jy5Pq8",
  "refund_mode": null,
  "refund_note": null,
  "refund_speed": {
    "requested": "STANDARD",
    "accepted": "STANDARD",
    "processed": null,
    "message": null
  },
  "refund_splits": [],
  "refund_status": "PENDING",
  "refund_type": "MERCHANT_INITIATED",
  "status_description": "In Progress"
}
]