In-App Payments SDK: Cookbook

Remove Postal Code Requirement

Remove the postal code requirement from In-App Payments SDK card entry form.

In-App Payments SDK
Java (Android)
Android
iOS
Save

Before you start

  • You have integrated the In-App Payments SDK into your iOS or Android application.
  • Your application can get the location country code of the merchant who is taking the payment. This must be done by your server backend using the Locations API, since payment will be taken on the customer's mobile device.
  • Your application is based in a country that does not require the postal code for processing payments.

Step 1: Get the location country of the merchant

Your mobile application will need to make a request to your server backend to get the correct location and location country. To be valid, the target location must have ACTIVE status, CREDIT_CARD_PROCESSING enabled, and the location.country field MUST NOT BE any of the following: US, CA, or GB.

Follow the steps in the Search for Locations to find the appropriate location.

Step 2: Remove the postal code requirement

In the CardEntry.startCardEntryActivity method, set the collectPostalCode parameter to false.

public class CheckoutActivity extends AppCompatActivity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.checkout_activity);

   //Find the add card button and set a click listener that starts the CardEntry activity
   findViewById(R.id.addCardButton).setOnClickListener(v -> {
     //Start the In-App Payments CardEntry activity
     CardEntry.startCardEntryActivity(CheckoutActivity.this, false);
   });
 }
}

In the CardEntry.startCardEntryActivity method, set the collectPostalCode parameter to false.

class CheckoutActivity : AppCompatActivity() {

 override fun onCreate(savedInstanceState: Bundle?) {
   super.onCreate(savedInstanceState)
   setContentView(R.layout.checkout_activity)
   //Find the add card button and set a click listener that starts the CardEntry activity
   findViewById<View>(R.id.addCardButton).setOnClickListener { _ ->
     //Start the In-App Payments CardEntry activity
     CardEntry.startCardEntryActivity(this@CheckoutActivity, false)
   }
 }
}

Set the collectPostalCode property on the SQIPCardEntryViewController to NO:

SQIPCardEntryViewController *cardEntryForm = [[SQIPCardEntryViewController alloc] initWithTheme:[[SQIPTheme alloc] init]];
cardEntryForm.collectPostalCode = NO;

Set the collectPostalCode property on the SQIPCardEntryViewController to false.

let cardEntryForm = SQIPCardEntryViewController(theme: SQIPTheme())

cardEntryForm.collectPostalCode = false

Contact Developer Support, join our Slack channel, or ask for help on Stack Overflow