Beta Release
This is pre-release documentation for an API in public beta and is subject to change.
In-App Payments SDK : Cookbook

Gift Card Payments

Java (Android)

Show the Square Gift Card payment entry form to accept a Square Gift Card payment. The Square Gift Card payment entry form accepts a Gift Card number and returns a nonce in the same way the payment card entry form does.

The nonce is returned for a valid Gift Card regardless of the balance on the card. When you submit the nonce to your payment backend, the lesser of the purchase price or Gift Card balance is charged on the Gift Card. When a Gift Card does not have enough of a balance to cover a purchase, your application should prompt the buyer to provide an additional payment method. To learn how to process a Gift Card nonce, see Create a Gift Card Payments Endpoint.

Before you start Permalink Get a link to this section

Show the Square Gift Card payment entry form Permalink Get a link to this section

In the CardEntry.startGiftCardEntryActivity method, set parameters for the parent activity and identifier the activity result with the buyer completion of the Gift Card entry.

If you have already implemented the payment entry form, reference the callback methods that you created for that form.

public class CheckoutActivity extends AppCompatActivity {

 protected void onCreate(Bundle savedInstanceState) {

   //Find the add gift card button and set a click listener that starts the Gift Card Entry activity
   findViewById( -> {
     //Start the In-App Payments Gift Card Entry activity