Class: Stripe::PaymentLink
- Inherits:
-
APIResource
- Object
- StripeObject
- APIResource
- Stripe::PaymentLink
- Extended by:
- APIOperations::Create, APIOperations::List
- Includes:
- APIOperations::Save
- Defined in:
- lib/stripe/resources/payment_link.rb
Overview
A payment link is a shareable URL that will take your customers to a hosted payment page. A payment link can be shared and used multiple times.
When a customer opens a payment link it will open a new [checkout session](stripe.com/docs/api/checkout/sessions) to render the payment page. You can use [checkout session events](stripe.com/docs/api/events/types#event_types-checkout.session.completed) to track payments through payment links.
Related guide: [Payment Links API](stripe.com/docs/payment-links)
Defined Under Namespace
Classes: AfterCompletion, AutomaticTax, ConsentCollection, CreateParams, CustomField, CustomText, InvoiceCreation, ListLineItemsParams, ListParams, PaymentIntentData, PhoneNumberCollection, Restrictions, RetrieveParams, ShippingAddressCollection, ShippingOption, SubscriptionData, TaxIdCollection, TransferData, UpdateParams
Constant Summary collapse
- OBJECT_NAME =
"payment_link"
Constants inherited from StripeObject
StripeObject::RESERVED_FIELD_NAMES
Instance Attribute Summary collapse
-
#active ⇒ Object
readonly
Whether the payment link’s ‘url` is active.
-
#after_completion ⇒ Object
readonly
Attribute for field after_completion.
-
#allow_promotion_codes ⇒ Object
readonly
Whether user redeemable promotion codes are enabled.
-
#application ⇒ Object
readonly
The ID of the Connect application that created the Payment Link.
-
#application_fee_amount ⇒ Object
readonly
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account.
-
#application_fee_percent ⇒ Object
readonly
This represents the percentage of the subscription invoice total that will be transferred to the application owner’s Stripe account.
-
#automatic_tax ⇒ Object
readonly
Attribute for field automatic_tax.
-
#billing_address_collection ⇒ Object
readonly
Configuration for collecting the customer’s billing address.
-
#consent_collection ⇒ Object
readonly
When set, provides configuration to gather active consent from customers.
-
#currency ⇒ Object
readonly
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase.
-
#custom_fields ⇒ Object
readonly
Collect additional information from your customer using custom fields.
-
#custom_text ⇒ Object
readonly
Attribute for field custom_text.
-
#customer_creation ⇒ Object
readonly
Configuration for Customer creation during checkout.
-
#id ⇒ Object
readonly
Unique identifier for the object.
-
#inactive_message ⇒ Object
readonly
The custom message to be displayed to a customer when a payment link is no longer active.
-
#invoice_creation ⇒ Object
readonly
Configuration for creating invoice for payment mode payment links.
-
#line_items ⇒ Object
readonly
The line items representing what is being sold.
-
#livemode ⇒ Object
readonly
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
-
#metadata ⇒ Object
readonly
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object.
-
#object ⇒ Object
readonly
String representing the object’s type.
-
#on_behalf_of ⇒ Object
readonly
The account on behalf of which to charge.
-
#payment_intent_data ⇒ Object
readonly
Indicates the parameters to be passed to PaymentIntent creation during checkout.
-
#payment_method_collection ⇒ Object
readonly
Configuration for collecting a payment method during checkout.
-
#payment_method_types ⇒ Object
readonly
The list of payment method types that customers can use.
-
#phone_number_collection ⇒ Object
readonly
Attribute for field phone_number_collection.
-
#restrictions ⇒ Object
readonly
Settings that restrict the usage of a payment link.
-
#shipping_address_collection ⇒ Object
readonly
Configuration for collecting the customer’s shipping address.
-
#shipping_options ⇒ Object
readonly
The shipping rate options applied to the session.
-
#submit_type ⇒ Object
readonly
Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button.
-
#subscription_data ⇒ Object
readonly
When creating a subscription, the specified configuration data will be used.
-
#tax_id_collection ⇒ Object
readonly
Attribute for field tax_id_collection.
-
#transfer_data ⇒ Object
readonly
The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
-
#url ⇒ Object
readonly
The public URL that can be shared with customers.
Attributes inherited from APIResource
Attributes inherited from StripeObject
Class Method Summary collapse
-
.create(params = {}, opts = {}) ⇒ Object
Creates a payment link.
-
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your payment links.
-
.list_line_items(payment_link, params = {}, opts = {}) ⇒ Object
When retrieving a payment link, there is an includable line_items property containing the first handful of those items.
- .object_name ⇒ Object
-
.update(id, params = {}, opts = {}) ⇒ Object
Updates a payment link.
Instance Method Summary collapse
-
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a payment link, there is an includable line_items property containing the first handful of those items.
Methods included from APIOperations::Create
Methods included from APIOperations::List
Methods included from APIOperations::Save
Methods inherited from APIResource
class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource
Methods included from APIOperations::Request
Methods inherited from StripeObject
#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values
Constructor Details
This class inherits a constructor from Stripe::StripeObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject
Instance Attribute Details
#active ⇒ Object (readonly)
Whether the payment link’s ‘url` is active. If `false`, customers visiting the URL will be shown a page saying that the link has been deactivated.
1517 1518 1519 |
# File 'lib/stripe/resources/payment_link.rb', line 1517 def active @active end |
#after_completion ⇒ Object (readonly)
Attribute for field after_completion
1519 1520 1521 |
# File 'lib/stripe/resources/payment_link.rb', line 1519 def after_completion @after_completion end |
#allow_promotion_codes ⇒ Object (readonly)
Whether user redeemable promotion codes are enabled.
1521 1522 1523 |
# File 'lib/stripe/resources/payment_link.rb', line 1521 def allow_promotion_codes @allow_promotion_codes end |
#application ⇒ Object (readonly)
The ID of the Connect application that created the Payment Link.
1523 1524 1525 |
# File 'lib/stripe/resources/payment_link.rb', line 1523 def application @application end |
#application_fee_amount ⇒ Object (readonly)
The amount of the application fee (if any) that will be requested to be applied to the payment and transferred to the application owner’s Stripe account.
1525 1526 1527 |
# File 'lib/stripe/resources/payment_link.rb', line 1525 def application_fee_amount @application_fee_amount end |
#application_fee_percent ⇒ Object (readonly)
This represents the percentage of the subscription invoice total that will be transferred to the application owner’s Stripe account.
1527 1528 1529 |
# File 'lib/stripe/resources/payment_link.rb', line 1527 def application_fee_percent @application_fee_percent end |
#automatic_tax ⇒ Object (readonly)
Attribute for field automatic_tax
1529 1530 1531 |
# File 'lib/stripe/resources/payment_link.rb', line 1529 def automatic_tax @automatic_tax end |
#billing_address_collection ⇒ Object (readonly)
Configuration for collecting the customer’s billing address. Defaults to ‘auto`.
1531 1532 1533 |
# File 'lib/stripe/resources/payment_link.rb', line 1531 def billing_address_collection @billing_address_collection end |
#consent_collection ⇒ Object (readonly)
When set, provides configuration to gather active consent from customers.
1533 1534 1535 |
# File 'lib/stripe/resources/payment_link.rb', line 1533 def @consent_collection end |
#currency ⇒ Object (readonly)
Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).
1535 1536 1537 |
# File 'lib/stripe/resources/payment_link.rb', line 1535 def currency @currency end |
#custom_fields ⇒ Object (readonly)
Collect additional information from your customer using custom fields. Up to 3 fields are supported.
1537 1538 1539 |
# File 'lib/stripe/resources/payment_link.rb', line 1537 def custom_fields @custom_fields end |
#custom_text ⇒ Object (readonly)
Attribute for field custom_text
1539 1540 1541 |
# File 'lib/stripe/resources/payment_link.rb', line 1539 def custom_text @custom_text end |
#customer_creation ⇒ Object (readonly)
Configuration for Customer creation during checkout.
1541 1542 1543 |
# File 'lib/stripe/resources/payment_link.rb', line 1541 def customer_creation @customer_creation end |
#id ⇒ Object (readonly)
Unique identifier for the object.
1543 1544 1545 |
# File 'lib/stripe/resources/payment_link.rb', line 1543 def id @id end |
#inactive_message ⇒ Object (readonly)
The custom message to be displayed to a customer when a payment link is no longer active.
1545 1546 1547 |
# File 'lib/stripe/resources/payment_link.rb', line 1545 def @inactive_message end |
#invoice_creation ⇒ Object (readonly)
Configuration for creating invoice for payment mode payment links.
1547 1548 1549 |
# File 'lib/stripe/resources/payment_link.rb', line 1547 def invoice_creation @invoice_creation end |
#line_items ⇒ Object (readonly)
The line items representing what is being sold.
1549 1550 1551 |
# File 'lib/stripe/resources/payment_link.rb', line 1549 def line_items @line_items end |
#livemode ⇒ Object (readonly)
Has the value ‘true` if the object exists in live mode or the value `false` if the object exists in test mode.
1551 1552 1553 |
# File 'lib/stripe/resources/payment_link.rb', line 1551 def livemode @livemode end |
#metadata ⇒ Object (readonly)
Set of [key-value pairs](stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
1553 1554 1555 |
# File 'lib/stripe/resources/payment_link.rb', line 1553 def @metadata end |
#object ⇒ Object (readonly)
String representing the object’s type. Objects of the same type share the same value.
1555 1556 1557 |
# File 'lib/stripe/resources/payment_link.rb', line 1555 def object @object end |
#on_behalf_of ⇒ Object (readonly)
The account on behalf of which to charge. See the [Connect documentation](support.stripe.com/questions/sending-invoices-on-behalf-of-connected-accounts) for details.
1557 1558 1559 |
# File 'lib/stripe/resources/payment_link.rb', line 1557 def on_behalf_of @on_behalf_of end |
#payment_intent_data ⇒ Object (readonly)
Indicates the parameters to be passed to PaymentIntent creation during checkout.
1559 1560 1561 |
# File 'lib/stripe/resources/payment_link.rb', line 1559 def payment_intent_data @payment_intent_data end |
#payment_method_collection ⇒ Object (readonly)
Configuration for collecting a payment method during checkout. Defaults to ‘always`.
1561 1562 1563 |
# File 'lib/stripe/resources/payment_link.rb', line 1561 def payment_method_collection @payment_method_collection end |
#payment_method_types ⇒ Object (readonly)
The list of payment method types that customers can use. When ‘null`, Stripe will dynamically show relevant payment methods you’ve enabled in your [payment method settings](dashboard.stripe.com/settings/payment_methods).
1563 1564 1565 |
# File 'lib/stripe/resources/payment_link.rb', line 1563 def payment_method_types @payment_method_types end |
#phone_number_collection ⇒ Object (readonly)
Attribute for field phone_number_collection
1565 1566 1567 |
# File 'lib/stripe/resources/payment_link.rb', line 1565 def phone_number_collection @phone_number_collection end |
#restrictions ⇒ Object (readonly)
Settings that restrict the usage of a payment link.
1567 1568 1569 |
# File 'lib/stripe/resources/payment_link.rb', line 1567 def restrictions @restrictions end |
#shipping_address_collection ⇒ Object (readonly)
Configuration for collecting the customer’s shipping address.
1569 1570 1571 |
# File 'lib/stripe/resources/payment_link.rb', line 1569 def shipping_address_collection @shipping_address_collection end |
#shipping_options ⇒ Object (readonly)
The shipping rate options applied to the session.
1571 1572 1573 |
# File 'lib/stripe/resources/payment_link.rb', line 1571 def @shipping_options end |
#submit_type ⇒ Object (readonly)
Indicates the type of transaction being performed which customizes relevant text on the page, such as the submit button.
1573 1574 1575 |
# File 'lib/stripe/resources/payment_link.rb', line 1573 def submit_type @submit_type end |
#subscription_data ⇒ Object (readonly)
When creating a subscription, the specified configuration data will be used. There must be at least one line item with a recurring price to use ‘subscription_data`.
1575 1576 1577 |
# File 'lib/stripe/resources/payment_link.rb', line 1575 def subscription_data @subscription_data end |
#tax_id_collection ⇒ Object (readonly)
Attribute for field tax_id_collection
1577 1578 1579 |
# File 'lib/stripe/resources/payment_link.rb', line 1577 def tax_id_collection @tax_id_collection end |
#transfer_data ⇒ Object (readonly)
The account (if any) the payments will be attributed to for tax reporting, and where funds from each payment will be transferred to.
1579 1580 1581 |
# File 'lib/stripe/resources/payment_link.rb', line 1579 def transfer_data @transfer_data end |
#url ⇒ Object (readonly)
The public URL that can be shared with customers.
1581 1582 1583 |
# File 'lib/stripe/resources/payment_link.rb', line 1581 def url @url end |
Class Method Details
.create(params = {}, opts = {}) ⇒ Object
Creates a payment link.
1584 1585 1586 |
# File 'lib/stripe/resources/payment_link.rb', line 1584 def self.create(params = {}, opts = {}) request_stripe_object(method: :post, path: "/v1/payment_links", params: params, opts: opts) end |
.list(params = {}, opts = {}) ⇒ Object
Returns a list of your payment links.
1589 1590 1591 |
# File 'lib/stripe/resources/payment_link.rb', line 1589 def self.list(params = {}, opts = {}) request_stripe_object(method: :get, path: "/v1/payment_links", params: params, opts: opts) end |
.list_line_items(payment_link, params = {}, opts = {}) ⇒ Object
When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
1604 1605 1606 1607 1608 1609 1610 1611 |
# File 'lib/stripe/resources/payment_link.rb', line 1604 def self.list_line_items(payment_link, params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(payment_link) }), params: params, opts: opts ) end |
.object_name ⇒ Object
16 17 18 |
# File 'lib/stripe/resources/payment_link.rb', line 16 def self.object_name "payment_link" end |
.update(id, params = {}, opts = {}) ⇒ Object
Updates a payment link.
1614 1615 1616 1617 1618 1619 1620 1621 |
# File 'lib/stripe/resources/payment_link.rb', line 1614 def self.update(id, params = {}, opts = {}) request_stripe_object( method: :post, path: format("/v1/payment_links/%<id>s", { id: CGI.escape(id) }), params: params, opts: opts ) end |
Instance Method Details
#list_line_items(params = {}, opts = {}) ⇒ Object
When retrieving a payment link, there is an includable line_items property containing the first handful of those items. There is also a URL where you can retrieve the full (paginated) list of line items.
1594 1595 1596 1597 1598 1599 1600 1601 |
# File 'lib/stripe/resources/payment_link.rb', line 1594 def list_line_items(params = {}, opts = {}) request_stripe_object( method: :get, path: format("/v1/payment_links/%<payment_link>s/line_items", { payment_link: CGI.escape(self["id"]) }), params: params, opts: opts ) end |