@@ -23,7 +23,7 @@ func (c *Client) GetOrder(ctx context.Context, orderID string) (*Order, error) {
2323 return order , nil
2424}
2525
26- // Create an order
26+ // CreateOrder Create an order
2727// Endpoint: POST /v2/checkout/orders
2828func (c * Client ) CreateOrder (ctx context.Context , intent string , purchaseUnits []PurchaseUnitRequest , paymentSource * PaymentSource , appContext * ApplicationContext ) (* Order , error ) {
2929 return c .CreateOrderWithPaypalRequestID (ctx , intent , purchaseUnits , paymentSource , appContext , "" )
@@ -113,7 +113,7 @@ func (c *Client) CaptureOrder(ctx context.Context, orderID string, captureOrderR
113113 return c .CaptureOrderWithPaypalRequestId (ctx , orderID , captureOrderRequest , "" , nil )
114114}
115115
116- // CaptureOrder with idempotency - https://developer.paypal.com/docs/api/orders/v2/#orders_capture
116+ // CaptureOrderWithPaypalRequestId with idempotency - https://developer.paypal.com/docs/api/orders/v2/#orders_capture
117117// Endpoint: POST /v2/checkout/orders/ID/capture
118118// https://developer.paypal.com/docs/api/reference/api-requests/#http-request-headers
119119func (c * Client ) CaptureOrderWithPaypalRequestId (ctx context.Context ,
@@ -143,6 +143,11 @@ func (c *Client) CaptureOrderWithPaypalRequestId(ctx context.Context,
143143 req .Header .Set ("PayPal-Mock-Response" , string (mock ))
144144 }
145145
146+ //Add for STC API, we need to link order together
147+ //https://developer.paypal.com/limited-release/raas/integration-guide/#link-setthetransactioncontext
148+ //https://developer.paypal.com/docs/api/orders/v2/#orders_capture!in=header&path=PayPal-Client-Metadata-Id&t=request
149+ req .Header .Set ("PayPal-Client-Metadata-Id" , orderID )
150+
146151 if err = c .SendWithAuth (req , capture ); err != nil {
147152 return capture , err
148153 }
@@ -156,7 +161,7 @@ func (c *Client) RefundCapture(ctx context.Context, captureID string, refundCapt
156161 return c .RefundCaptureWithPaypalRequestId (ctx , captureID , refundCaptureRequest , "" )
157162}
158163
159- // RefundCapture with idempotency - https://developer.paypal.com/docs/api/payments/v2/#captures_refund
164+ // RefundCaptureWithPaypalRequestId with idempotency - https://developer.paypal.com/docs/api/payments/v2/#captures_refund
160165// Endpoint: POST /v2/payments/captures/ID/refund
161166func (c * Client ) RefundCaptureWithPaypalRequestId (ctx context.Context ,
162167 captureID string ,
0 commit comments