ICheckoutApi checkoutApi = client.CheckoutApi;
CheckoutApi
- Create Checkout
- Retrieve Location Settings
- Update Location Settings
- Retrieve Merchant Settings
- Update Merchant Settings
- List Payment Links
- Create Payment Link
- Delete Payment Link
- Retrieve Payment Link
- Update Payment Link
This endpoint is deprecated.
Links a checkoutId
to a checkout_page_url
that customers are
directed to in order to provide their payment information using a
payment processing workflow hosted on connect.squareup.com.
NOTE: The Checkout API has been updated with new features. For more information, see Checkout API highlights.
CreateCheckoutAsync(
string locationId,
Models.CreateCheckoutRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string |
Template, Required | The ID of the business location to associate the checkout with. |
body |
CreateCheckoutRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreateCheckoutResponse>
string locationId = "location_id4";
CreateCheckoutRequest body = new CreateCheckoutRequest.Builder(
"86ae1696-b1e3-4328-af6d-f1e04d947ad6",
new CreateOrderRequest.Builder()
.Order(
new Order.Builder(
"location_id"
)
.ReferenceId("reference_id")
.CustomerId("customer_id")
.LineItems(
new List<OrderLineItem>
{
new OrderLineItem.Builder(
"2"
)
.Name("Printed T Shirt")
.AppliedTaxes(
new List<OrderLineItemAppliedTax>
{
new OrderLineItemAppliedTax.Builder(
"38ze1696-z1e3-5628-af6d-f1e04d947fg3"
)
.Build(),
})
.AppliedDiscounts(
new List<OrderLineItemAppliedDiscount>
{
new OrderLineItemAppliedDiscount.Builder(
"56ae1696-z1e3-9328-af6d-f1e04d947gd4"
)
.Build(),
})
.BasePriceMoney(
new Money.Builder()
.Amount(1500L)
.Currency("USD")
.Build())
.Build(),
new OrderLineItem.Builder(
"1"
)
.Name("Slim Jeans")
.BasePriceMoney(
new Money.Builder()
.Amount(2500L)
.Currency("USD")
.Build())
.Build(),
new OrderLineItem.Builder(
"3"
)
.Name("Woven Sweater")
.BasePriceMoney(
new Money.Builder()
.Amount(3500L)
.Currency("USD")
.Build())
.Build(),
})
.Taxes(
new List<OrderLineItemTax>
{
new OrderLineItemTax.Builder()
.Uid("38ze1696-z1e3-5628-af6d-f1e04d947fg3")
.Type("INCLUSIVE")
.Percentage("7.75")
.Scope("LINE_ITEM")
.Build(),
})
.Discounts(
new List<OrderLineItemDiscount>
{
new OrderLineItemDiscount.Builder()
.Uid("56ae1696-z1e3-9328-af6d-f1e04d947gd4")
.Type("FIXED_AMOUNT")
.AmountMoney(
new Money.Builder()
.Amount(100L)
.Currency("USD")
.Build())
.Scope("LINE_ITEM")
.Build(),
})
.Build())
.IdempotencyKey("12ae1696-z1e3-4328-af6d-f1e04d947gd4")
.Build()
)
.AskForShippingAddress(true)
.MerchantSupportEmail("[email protected]")
.PrePopulateBuyerEmail("[email protected]")
.PrePopulateShippingAddress(
new Address.Builder()
.AddressLine1("1455 Market St.")
.AddressLine2("Suite 600")
.Locality("San Francisco")
.AdministrativeDistrictLevel1("CA")
.PostalCode("94103")
.Country("US")
.FirstName("Jane")
.LastName("Doe")
.Build())
.RedirectUrl("https://merchant.website.com/order-confirm")
.AdditionalRecipients(
new List<ChargeRequestAdditionalRecipient>
{
new ChargeRequestAdditionalRecipient.Builder(
"057P5VYJ4A5X1",
"Application fees",
new Money.Builder()
.Amount(60L)
.Currency("USD")
.Build()
)
.Build(),
})
.Build();
try
{
CreateCheckoutResponse result = await checkoutApi.CreateCheckoutAsync(
locationId,
body
);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves the location-level settings for a Square-hosted checkout page.
RetrieveLocationSettingsAsync(
string locationId)
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string |
Template, Required | The ID of the location for which to retrieve settings. |
Task<Models.RetrieveLocationSettingsResponse>
string locationId = "location_id4";
try
{
RetrieveLocationSettingsResponse result = await checkoutApi.RetrieveLocationSettingsAsync(locationId);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Updates the location-level settings for a Square-hosted checkout page.
UpdateLocationSettingsAsync(
string locationId,
Models.UpdateLocationSettingsRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
locationId |
string |
Template, Required | The ID of the location for which to retrieve settings. |
body |
UpdateLocationSettingsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateLocationSettingsResponse>
string locationId = "location_id4";
UpdateLocationSettingsRequest body = new UpdateLocationSettingsRequest.Builder(
new CheckoutLocationSettings.Builder()
.Build()
)
.Build();
try
{
UpdateLocationSettingsResponse result = await checkoutApi.UpdateLocationSettingsAsync(
locationId,
body
);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves the merchant-level settings for a Square-hosted checkout page.
RetrieveMerchantSettingsAsync()
Task<Models.RetrieveMerchantSettingsResponse>
try
{
RetrieveMerchantSettingsResponse result = await checkoutApi.RetrieveMerchantSettingsAsync();
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Updates the merchant-level settings for a Square-hosted checkout page.
UpdateMerchantSettingsAsync(
Models.UpdateMerchantSettingsRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
UpdateMerchantSettingsRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdateMerchantSettingsResponse>
UpdateMerchantSettingsRequest body = new UpdateMerchantSettingsRequest.Builder(
new CheckoutMerchantSettings.Builder()
.Build()
)
.Build();
try
{
UpdateMerchantSettingsResponse result = await checkoutApi.UpdateMerchantSettingsAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Lists all payment links.
ListPaymentLinksAsync(
string cursor = null,
int? limit = null)
Parameter | Type | Tags | Description |
---|---|---|---|
cursor |
string |
Query, Optional | A pagination cursor returned by a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. If a cursor is not provided, the endpoint returns the first page of the results. For more information, see Pagination. |
limit |
int? |
Query, Optional | A limit on the number of results to return per page. The limit is advisory and the implementation might return more or less results. If the supplied limit is negative, zero, or greater than the maximum limit of 1000, it is ignored. Default value: 100 |
Task<Models.ListPaymentLinksResponse>
try
{
ListPaymentLinksResponse result = await checkoutApi.ListPaymentLinksAsync();
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services.
CreatePaymentLinkAsync(
Models.CreatePaymentLinkRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
body |
CreatePaymentLinkRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.CreatePaymentLinkResponse>
CreatePaymentLinkRequest body = new CreatePaymentLinkRequest.Builder()
.IdempotencyKey("cd9e25dc-d9f2-4430-aedb-61605070e95f")
.QuickPay(
new QuickPay.Builder(
"Auto Detailing",
new Money.Builder()
.Amount(10000L)
.Currency("USD")
.Build(),
"A9Y43N9ABXZBP"
)
.Build())
.Build();
try
{
CreatePaymentLinkResponse result = await checkoutApi.CreatePaymentLinkAsync(body);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Deletes a payment link.
DeletePaymentLinkAsync(
string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The ID of the payment link to delete. |
Task<Models.DeletePaymentLinkResponse>
string id = "id0";
try
{
DeletePaymentLinkResponse result = await checkoutApi.DeletePaymentLinkAsync(id);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Retrieves a payment link.
RetrievePaymentLinkAsync(
string id)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The ID of link to retrieve. |
Task<Models.RetrievePaymentLinkResponse>
string id = "id0";
try
{
RetrievePaymentLinkResponse result = await checkoutApi.RetrievePaymentLinkAsync(id);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}
Updates a payment link. You can update the payment_link
fields such as
description
, checkout_options
, and pre_populated_data
.
You cannot update other fields such as the order_id
, version
, URL
, or timestamp
field.
UpdatePaymentLinkAsync(
string id,
Models.UpdatePaymentLinkRequest body)
Parameter | Type | Tags | Description |
---|---|---|---|
id |
string |
Template, Required | The ID of the payment link to update. |
body |
UpdatePaymentLinkRequest |
Body, Required | An object containing the fields to POST for the request. See the corresponding object definition for field details. |
Task<Models.UpdatePaymentLinkResponse>
string id = "id0";
UpdatePaymentLinkRequest body = new UpdatePaymentLinkRequest.Builder(
new PaymentLink.Builder(
1
)
.CheckoutOptions(
new CheckoutOptions.Builder()
.AskForShippingAddress(true)
.Build())
.Build()
)
.Build();
try
{
UpdatePaymentLinkResponse result = await checkoutApi.UpdatePaymentLinkAsync(
id,
body
);
}
catch (ApiException e)
{
// TODO: Handle exception here
Console.WriteLine(e.Message);
}