Module: PaypalAPI::Invoices::APIs

Included in:
PaypalAPI::Invoices, PaypalAPI::Invoices
Defined in:
lib/paypal-api/api_collections/invoices.rb

Overview

Common methods for PaypalAPI::Invoices class and client.invoices instance

Instance Method Summary collapse

Instance Method Details

#cancel(invoice_id, query: nil, body: nil, headers: nil) ⇒ Response

Cancel sent invoice

Parameters:

  • invoice_id (String)

    Invoice 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:



167
168
169
# File 'lib/paypal-api/api_collections/invoices.rb', line 167

def cancel(invoice_id, query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/cancel", query: query, body: body, headers: headers)
end

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

Create draft invoice

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/invoices.rb', line 27

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

#delete(invoice_id, query: nil, body: nil, headers: nil) ⇒ Response

Delete invoice

Parameters:

  • invoice_id (String)

    Invoice 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:



71
72
73
# File 'lib/paypal-api/api_collections/invoices.rb', line 71

def delete(invoice_id, query: nil, body: nil, headers: nil)
  client.delete("/v2/invoicing/invoices/#{encode(invoice_id)}", query: query, body: body, headers: headers)
end

#delete_payment(invoice_id, transaction_id, query: nil, body: nil, headers: nil) ⇒ Response

Delete external payment

Parameters:

  • invoice_id (String)

    Invoice ID

  • transaction_id (String)

    The ID of the external payment transaction to delete.

  • 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:



120
121
122
123
124
125
# File 'lib/paypal-api/api_collections/invoices.rb', line 120

def delete_payment(invoice_id, transaction_id, query: nil, body: nil, headers: nil)
  client.delete(
    "/v2/invoicing/invoices/#{encode(invoice_id)}/payments/#{encode(transaction_id)}",
    query: query, body: body, headers: headers
  )
end

#delete_refund(invoice_id, transaction_id, query: nil, body: nil, headers: nil) ⇒ Response

Delete external refund

Parameters:

  • invoice_id (String)

    Invoice ID

  • transaction_id (String)

    The ID of the external refund transaction to delete.

  • 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:



105
106
107
108
109
110
# File 'lib/paypal-api/api_collections/invoices.rb', line 105

def delete_refund(invoice_id, transaction_id, query: nil, body: nil, headers: nil)
  client.delete(
    "/v2/invoicing/invoices/#{encode(invoice_id)}/refunds/#{encode(transaction_id)}",
    query: query, body: body, headers: headers
  )
end

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

Generate invoice number

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:



188
189
190
# File 'lib/paypal-api/api_collections/invoices.rb', line 188

def generate_invoice_number(query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/generate-next-invoice-number", query: query, body: body, headers: headers)
end

#generate_qr_code(invoice_id, query: nil, body: nil, headers: nil) ⇒ Response

Generate QR code

Parameters:

  • invoice_id (String)

    Invoice 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:



178
179
180
# File 'lib/paypal-api/api_collections/invoices.rb', line 178

def generate_qr_code(invoice_id, query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/generate-qr-code", query: query, body: body, headers: headers)
end

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

List invoices

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:



38
39
40
# File 'lib/paypal-api/api_collections/invoices.rb', line 38

def list(query: nil, body: nil, headers: nil)
  client.get("/v2/invoicing/invoices", query: query, body: body, headers: headers)
end

#record_payment(invoice_id, query: nil, body: nil, headers: nil) ⇒ Response

Record payment for invoice

Parameters:

  • invoice_id (String)

    Invoice 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:



134
135
136
# File 'lib/paypal-api/api_collections/invoices.rb', line 134

def record_payment(invoice_id, query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/payments", query: query, body: body, headers: headers)
end

#record_refund(invoice_id, query: nil, body: nil, headers: nil) ⇒ Response

Record refund for invoice

Parameters:

  • invoice_id (String)

    Invoice 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:



145
146
147
# File 'lib/paypal-api/api_collections/invoices.rb', line 145

def record_refund(invoice_id, query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/refunds", query: query, body: body, headers: headers)
end

#remind(invoice_id, query: nil, body: nil, headers: nil) ⇒ Response

Send invoice reminder

Parameters:

  • invoice_id (String)

    Invoice 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:



93
94
95
# File 'lib/paypal-api/api_collections/invoices.rb', line 93

def remind(invoice_id, query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/remind", query: query, body: body, headers: headers)
end

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

Search for invoices

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:



82
83
84
# File 'lib/paypal-api/api_collections/invoices.rb', line 82

def search(query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/search-invoices", query: query, body: body, headers: headers)
end

#send_invoice(invoice_id, query: nil, body: nil, headers: nil) ⇒ Response

Send invoice

Parameters:

  • invoice_id (String)

    Invoice 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:



156
157
158
# File 'lib/paypal-api/api_collections/invoices.rb', line 156

def send_invoice(invoice_id, query: nil, body: nil, headers: nil)
  client.post("/v2/invoicing/invoices/#{encode(invoice_id)}/send", query: query, body: body, headers: headers)
end

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

Show invoice details

Parameters:

  • invoice_id (String)

    Invoice 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:



49
50
51
# File 'lib/paypal-api/api_collections/invoices.rb', line 49

def show(invoice_id, query: nil, body: nil, headers: nil)
  client.get("/v2/invoicing/invoices/#{encode(invoice_id)}", query: query, body: body, headers: headers)
end

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

Fully update invoice

Parameters:

  • invoice_id (String)

    Invoice 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:



60
61
62
# File 'lib/paypal-api/api_collections/invoices.rb', line 60

def update(invoice_id, query: nil, body: nil, headers: nil)
  client.put("/v2/invoicing/invoices/#{encode(invoice_id)}", query: query, body: body, headers: headers)
end