Module: PaypalAPI::Orders::APIs

Included in:
PaypalAPI::Orders, PaypalAPI::Orders
Defined in:
lib/paypal-api/api_collections/orders.rb

Overview

Common methods for PaypalAPI::Orders class and client.orders instance

Instance Method Summary collapse

Instance Method Details

#authorize(id, query: nil, body: nil, headers: nil) ⇒ Response

Authorize payment for order

Parameters:

  • id (String)

    Order ID

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



75
76
77
# File 'lib/paypal-api/api_collections/orders.rb', line 75

def authorize(id, query: nil, body: nil, headers: nil)
  client.post("/v2/checkout/orders/#{encode(id)}/authorize", query: query, body: body, headers: headers)
end

#capture(id, query: nil, body: nil, headers: nil) ⇒ Response

Capture payment for order

Parameters:

  • id (String)

    Order ID

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



87
88
89
# File 'lib/paypal-api/api_collections/orders.rb', line 87

def capture(id, query: nil, body: nil, headers: nil)
  client.post("/v2/checkout/orders/#{encode(id)}/capture", query: query, body: body, headers: headers)
end

#confirm(id, query: nil, body: nil, headers: nil) ⇒ Response

Confirm the Order

Parameters:

  • id (String)

    Order ID

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



63
64
65
# File 'lib/paypal-api/api_collections/orders.rb', line 63

def confirm(id, query: nil, body: nil, headers: nil)
  client.post("/v2/checkout/orders/#{encode(id)}/confirm-payment-source", query: query, body: body, headers: headers)
end

#create(query: nil, body: nil, headers: nil) ⇒ Response

Create Order

Parameters:

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



27
28
29
# File 'lib/paypal-api/api_collections/orders.rb', line 27

def create(query: nil, body: nil, headers: nil)
  client.post("/v2/checkout/orders", query: query, body: body, headers: headers)
end

#show(id, query: nil, body: nil, headers: nil) ⇒ Response

Show order details

Parameters:

  • id (String)

    Order ID

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



39
40
41
# File 'lib/paypal-api/api_collections/orders.rb', line 39

def show(id, query: nil, body: nil, headers: nil)
  client.get("/v2/checkout/orders/#{encode(id)}", query: query, body: body, headers: headers)
end

#track(id, query: nil, body: nil, headers: nil) ⇒ Response

Add tracking information for an Order

Parameters:

  • id (String)

    Order ID

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



99
100
101
# File 'lib/paypal-api/api_collections/orders.rb', line 99

def track(id, query: nil, body: nil, headers: nil)
  client.post("/v2/checkout/orders/#{encode(id)}/track", query: query, body: body, headers: headers)
end

#update(id, query: nil, body: nil, headers: nil) ⇒ Response

Update order

Parameters:

  • id (String)

    Order ID

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



51
52
53
# File 'lib/paypal-api/api_collections/orders.rb', line 51

def update(id, query: nil, body: nil, headers: nil)
  client.patch("/v2/checkout/orders/#{encode(id)}", query: query, body: body, headers: headers)
end

#update_tracker(id, tracker_id, query: nil, body: nil, headers: nil) ⇒ Response

Update or cancel tracking information for a PayPal order

Parameters:

  • id (String)

    Order ID

  • tracker_id (String)

    Tracker ID

  • query (Hash, nil) (defaults to: nil)

    Request query parameters

  • body (Hash, nil) (defaults to: nil)

    Request body parameters

  • headers (Hash, nil) (defaults to: nil)

    Request headers

Returns:

See Also:



112
113
114
# File 'lib/paypal-api/api_collections/orders.rb', line 112

def update_tracker(id, tracker_id, query: nil, body: nil, headers: nil)
  client.patch("/v2/checkout/orders/#{encode(id)}/trackers/#{encode(tracker_id)}", query: query, body: body, headers: headers)
end