Skip to content
This repository was archived by the owner on Jan 2, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func (h *Handler) serveCheckout(w http.ResponseWriter, r *http.Request) error {
Features: fs,
CancelURL: cr.CancelURL,
RequireBillingAddress: cr.RequireBillingAddress,
UpdateCustomerAddress: cr.UpdateCustomerAddress,
AutomaticTax: cr.Tax.Automatic,
CollectTaxID: cr.Tax.CollectID,
})
Expand Down
1 change: 1 addition & 0 deletions api/apitypes/apitypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ type CheckoutRequest struct {
SuccessURL string `json:"success_url"`
CancelURL string `json:"cancel_url"`
RequireBillingAddress bool `json:"require_billing_address"`
UpdateCustomerAddress bool `json:"update_customer_address"`
Tax Taxation `json:"tax"`
}

Expand Down
2 changes: 2 additions & 0 deletions client/tier/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ func (c *Client) Checkout(ctx context.Context, org string, successURL string, p
TrialDays: p.TrialDays,
Features: p.Features,
RequireBillingAddress: p.RequireBillingAddress,
UpdateCustomerAddress: p.UpdateCustomerAddress,
Tax: p.Tax,
}
return fetchOK[*apitypes.CheckoutResponse, *apitypes.Error](ctx, c, "POST", "/v1/checkout", r)
Expand All @@ -315,6 +316,7 @@ type CheckoutParams struct {
Features []string
CancelURL string
RequireBillingAddress bool
UpdateCustomerAddress bool
Tax Taxation
}

Expand Down
4 changes: 4 additions & 0 deletions control/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ type CheckoutParams struct {
Features []Feature
CancelURL string
RequireBillingAddress bool
UpdateCustomerAddress bool // if true, update customer address to the address entered at checkout
AutomaticTax bool
CollectTaxID bool
}
Expand Down Expand Up @@ -568,6 +569,9 @@ func (c *Client) Checkout(ctx context.Context, org string, successURL string, p
if p.RequireBillingAddress {
f.Set("billing_address_collection", "required")
}
if p.UpdateCustomerAddress {
f.Set("customer_update", "address", "auto")
}
if len(p.Features) == 0 {
f.Set("mode", "setup")
// TODO: support other payment methods:
Expand Down