lakhassane
lakhassane

Reputation: 141

Integrating cordova plugin paypal with ionic

I'm trying to use the paypal-cordova-plugin to integrate paiement on my mobile app. But the instructions I am following are asking for sandbox id and production id but I have no idea where to find them in paypal. Can someone help me on this ?

This is the place where they are asked

angular.module('app')
  .constant("shopSettings", (function () {
    return {

      payPalSandboxId: "Aar8HZzvc5NztVWodTBpOiOod9wWrBDrJUjyvRr4WsxcCD28xYig7oecfYsqxQUDu5QHptPpSALirxZD",

      payPalProductionId : "production id here",

      payPalEnv: "PayPalEnvironmentSandbo", // for testing production for production

      payPalShopName : "SenPass",

      payPalMerchantPrivacyPolicyURL : "url to policy",

      payPalMerchantUserAgreementURL : "url to user agreement"


    }
  })());

This is the link I'm following : http://ionicandroidlearning.blogspot.fr/2015/11/ionic-paypal-integration.html

Upvotes: 1

Views: 1982

Answers (2)

Hosar
Hosar

Reputation: 5292

  1. First you need to create an account on paypal developers.
  2. Then inside the dashboard create a new application (REST API apps).dashboard
  3. When you create the new app, Paypal will generate a sandbox account and a client id for you.
  4. Add the code (example):

var configuration=function () {
	var configOptions = {
		merchantName: "Some name you have specified", 
		merchantPrivacyPolicyURL: "http://yourserver/privacypolicy",
		merchantUserAgreementURL: "http://yourserver/agreement",
		languageOrLocale: "en_US"
	};
     // for more options see paypal-mobile-js-helper.js
     var _config = new PayPalConfiguration( configOptions );
     return _config;
}
var onPrepareRender = function(){
	$log.info(" ======= onPrepareRender ==========");				
}	

var onPayPalMobileInit = function(){
	var payPalConfig =  configuration();				
	PayPalMobile.prepareToRender("PayPalEnvironmentSandbox", payPalConfig, onPrepareRender);
	deferred.resolve( payPalConfig );
}

var clientIDs = {	
	"PayPalEnvironmentProduction": '', //leave it blank
	"PayPalEnvironmentSandbox": 'your sandbox id'
};

PayPalMobile.init(clientIDs, onPayPalMobileInit);

Upvotes: 2

federico scamuzzi
federico scamuzzi

Reputation: 3778

to retrive PayPal Sandobx keys try to go here:

https://developer.paypal.com/developer/accounts/

click on your generated account for testing (in the table) and then on Profile ...it open a modal with some tabs .. choose the API Credential tab

Hope it can help you

Upvotes: 0

Related Questions