Applies to: In-App Payments SDK - Android | In-App Payments SDK - iOS
Learn how to support Square gift card payments with the In-App Payments SDK.
Applies to: In-App Payments SDK - Android | In-App Payments SDK - iOS
Learn how to support Square gift card payments with the In-App Payments SDK.
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 payment token in the same way the payment card entry form does.
The payment token is returned for a valid gift card regardless of the balance on the card. When you submit the payment token to your payment backend, the lesser of the purchase price or gift card balance is charged on the gift card. When a gift card doesn't 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 payment token, see Take a Gift Card Payment.
You have integrated the In-App Payments SDK into your iOS or Android application.
In the CardEntry.startGiftCardEntryActivity
method, set parameters for the parent activity and identifier 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 {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.checkout_activity);
//Find the add Gift Card button and set a click listener that starts the Gift card Entry activity
findViewById(R.id.enter_gift_card_button).setOnClickListener(v -> {
//Start the In-App Payments Gift Card Entry activity
CardEntry.startGiftCardEntryActivity(
MainActivity.this,
DEFAULT_CARD_ENTRY_REQUEST_CODE));
});
}
}
If you need more assistance, contact Developer and App Marketplace Support or ask for help in the Developer Forums.