sandbox paypal что это
Внедрение PayPal на сайт, работающий под ASP.NET
Намедни возникла задача внедрения PayPal на коммерческий сайт, работающий под ASP.NET. После детального изучения данного вопроса, выяснилось, что в рунете инфы по нему очень мало. Посему думаю, что будет уместно осветить данный вопрос. Начнем, как всегда, с постановки задачи.
Постановка задачи
Имеем интернет-магазин, на котором пользователь выбирает товар, вводит данные о своей кредитке и оплачивает его через инет. Инфа о кредитке вводится непосредственно на сайте. Транзакция на снятие денег должна проходить через PayPal.
Решение
Шаг 1. Регистрация в PayPal Sandbox
Чтобы иметь возможность тестирования необходимо зарегистрироваться в тестовой среде, которая называется Sandbox. Делается это следующим образом:
1. Заходим на developer.paypal.com там регистрируем новый аккаунт.
2. Логинимся на developer.paypal.com, заходим в закладку Test Accounts и создаем там новый тестовый аккаунт продавца. Во время создания выбираем опцию seller. В поле password будет стоять пароль, необходимый для того чтобы потом залогиниться в SandBox. После создания появится аккаунт с Email’ом типа blabla_1234567890_biz[at]email.com и паролем, который был в поле password. Используя их
3. Логинимся на www.sandbox.paypal.com. После залогинивания необходимо принять Billing Agreement.
Шаг 2. Интеграция в сайт
Подводные камни
1. Тестовая кредитка покупателя:
CreditCardType: Visa
CreditCardNumber: 4197058882575379
VerificationCode: 926
ExpirationDate 2010-10
2. Среда выполнения у нас тестовая, поэтому в качестве параметра Environment используем «sandbox», чтоб включить «реальный» PayPal, надо указать «live», но это надо уточнить в официальной доке.
3. Инфу для MerchantProfile брать в разделе API Credentials на developer.paypal.com
4. Данная обертка использует способ передачи между PayPal сервером и сайтом, которая называется 3-token, есть еще возможность это делать на основе сертификатов, но это мне показалось гиморным, поэтому я не разбирался с этим. RTFM.
5. Если вы получаете ошибку «Security header is not valid », значит неверно указаны параметры для MerchantProfile
6. Если вы получаете ошибку «This transaction cannot be processed due to an invalid merchant configuration», значит не было принято Billing Agreement. Смотри третий пункт раздела «Регистрация в PayPal Sandbox»
Предупреждаю сразу, что обертка не проходила усиленное тестирование и вы как всегда все юзаете на свой страх и риск. Но вроде бы там все должно работать. Если что, пишите сюда paradoxs.mail@gmail.com
Ссылочки
Центр Интеграции, Что такое Sandbox, Качнуть SDK под разные платформы
Тестируем WordPress-плагины в PayPal Sandbox
Все плагины WordPress, которые позволяют принимать платежи, начиная с плагинов для электронной коммерции и заканчивая плагинами для сбора пожертвований, предлагают интеграцию с PayPal продуктом. Тестирование этой интеграции еще до запуска сайта подразумевает под собой настройку песочницы PayPal (PayPal Sandbox), а это, как и сам PayPal, может показаться сложным действием.
В данной статье мы взглянем на то, как создать песочницу PayPal, а также где найти данные, которые требуются большинству плагинов WordPress, поддерживающих PayPal.
Экосистема PayPal состоит из трех компонентов:
Чтобы протестировать плагин с PayPal, вам необходимо:
Важно помнить, что данные для песочницы и реальные PayPal-данные жестко разделены. Вы не можете использовать реальный PayPal аккаунт для тестирования плагина, настроенного под песочницу, и вы не можете использовать аккаунт песочницы, если ваш плагин настроен под реальный шлюз.
Неприятное последствие всего этого: вы, конечно, можете протестировать свой плагин, однако вам придется реконфигурировать его после тестирования, чтобы связать его с живой средой PayPal, т.е. вам придется его вновь протестировать, но уже на живом аккаунте, чтобы убедиться, что все настроено корректно.
Шаг 1. Создаем аккаунт разработчика.
Переходим к PayPal Developer Portal и либо входим в него (если у вас уже есть существующий PayPal-аккаунт), либо регистрируем новый аккаунт.
Шаг 2. Создаем тестовые пользовательские аккаунты.
Чтобы просмотреть существующие аккаунты или создать новые, щелкните по вкладке Applications и выберите Sandbox accounts.
Вы обнаружите, что у вас уже есть созданный Business PayPal аккаунт. Это ваш мерчант-аккаунт для песочницы, и именно он будет включать в себя все конфигурационные данные для плагина; здесь же вы сможете видеть все ваши данные по тестовым транзакциям.
После тестирования своего плагина вы непременно захотите протестировать проведение платежей с вашего тестового пользовательского аккаунта. Чтобы создать новый аккаунт, щелкните по кнопке New Account и заполните форму.
Как вы видите, вы можете создать аккаунт с различными настройками, включая тип кредитной карты. Количество учетных записей будет зависеть от того, сколько вариантов оплаты вы хотите протестировать.
Хорошее эмпирическое правило – чем больше тестирования, тем лучше.
Шаг 3. Настраиваем свой плагин для использования в песочнице.
Этот шаг многим может показаться запутанным, поскольку требования конфигурации зависят от того, как именно ваш тестовый плагин интегрируется с PayPal.
В целом, страница настроек плагина будет содержать комбинацию следующих данных:
PayPal Mode
PayPal Email Address
Если плагин будет использовать PayPal Simple Payment, то в таком случае вам понадобится указать почтовый адрес. Вам нужно ввести почтовый адрес для бизнес-аккаунта песочницы, который был автоматически задан для вас, когда вы вошли в портал разработчика.
Вы можете видеть этот почтовый адрес, если вы перейдете по ссылке Applications – Sandbox accounts.
PayPal Merchant Account ID
Это поле обычно требуется, когда плагин использует шлюз Payments Standard и нуждается в Merchant ID для бизнес-аккаунта Sandbox.
К сожалению, эти данные недоступны в портале разработчика, поэтому вам понадобится войти на сайт PayPal Sandbox, используя учетные данные бизнес-аккаунта песочницы.
Сайт песочницы может несколько сбить с толку, поскольку в самом верху страницы он показывает, что вы вошли под своим аккаунтом, однако вы по-прежнему должны войти в бизнес-аккаунт песочницы, чтобы получить необходимую информацию.
Как только вы войдете, щелкните по Profile – My Business Info.
Вы увидите различные данные, которые являются придуманными, однако их можно обновлять. Merchant ID будет показан ближе к низу списка.
Вы можете изменить здесь имя аккаунта (на название вашей фирмы), чтобы платежные страницы PayPal выглядели более реалистично.
PayPal Site
Это очень важные данные. Убедитесь в том, что выбранная страна совпадает с той страной, которая указана в адресе бизнес-аккаунта.
PayPal API Credentials
Если ваш плагин использует PayPal API для доступа к шлюзу PayPal, вам нужно будет ввести для него имя пользователя, пароль и сигнатуру.
Эти данные можно найти в портале разработчика:
Плагин готов для тестирования
Хорошая идея, которая верна и для премиальных плагинов – нужно протестировать столько сценариев, сколько вы можете, особенно если у вас подключен процесс оплаты. Будем надеяться, что данная запись помогла вам найти все данные, которые требуются для интеграции вашего плагина с PayPal.
Естественно, после того как вы провели тестирование, не забудьте реконфигурировать ваш плагин, чтобы использовать его в живой среде PayPal.
PayPal sandbox
The PayPal sandbox is a self-contained, virtual testing environment that simulates the live PayPal production environment. The sandbox provides a shielded space where you can initiate and watch while your apps process PayPal API requests without touching any live PayPal accounts.
While some PayPal features do not apply to the sandbox, such as closing an account, issuing monthly statements, and storing shipping preferences, the sandbox has the same PayPal API feature set as the live environment.
When you test a transaction through a sandbox account, PayPal creates a mock transaction that behaves exactly like a transaction in the live environment. By using fictitious sandbox accounts with their associated authentication credentials in your PayPal API calls, you can test and debug your apps without referencing any real PayPal users or live PayPal accounts.
The sandbox has these components:
Component | Access through |
---|---|
Sandbox API base URL | https://api-m.sandbox.paypal.com/ |
Sandbox test site | https://www.sandbox.paypal.com/. You use the personal and business credentials you find on the Sandbox > Accounts page in the Developer Dashboard to log into the sandbox as either a buyer (personal) or seller (business). |
Sandbox API URLs
Sandbox test site
Get sandbox test site login
Confirm an action in the sandbox test site
After you complete an action that affects a PayPal account, such as making a purchase using the PayPal balance or creating an invoice, you can confirm that the action completed as you expected by logging into the sandbox test site.
Use the sandbox account email IDs and passwords to log in as either a buyer (personal) or as a merchant (business).
PayPal sandbox testing guide
Overview
The PayPal sandbox is a self-contained, virtual testing environment that simulates the live PayPal production environment. The sandbox provides a shielded space where you can initiate and watch while your apps process PayPal API requests without touching any live PayPal accounts.
The PayPal sandbox mirrors the features on the PayPal production servers. While some PayPal features do not apply to the sandbox, such as closing an account, issuing monthly statements, storing shipping preferences, and PayPal Shops support, the sandbox has the same PayPal API feature set as the live environment. You can test your PayPal processes in the sandbox. Processes behave the same in the sandbox environment as they do on production servers.
When you initiate a transaction through a sandbox account, PayPal creates a mock transaction that behaves exactly like a transaction in the live environment. By using fictitious sandbox accounts with their associated authentication credentials in your PayPal API calls, you can test and debug your apps without referencing any real PayPal users or live PayPal accounts.
The sandbox lets you operate your application in a safe environment and provides a way to fine-tune your PayPal routines before you move your product into production.
The PayPal sandbox is made up of these components:
Component | Access through |
---|---|
Sandbox test site | https://www.sandbox.paypal.com/ |
Sandbox > Accounts page | https://developer.paypal.com/developer/accounts |
Just as you track live transactions on the PayPal live site, you track your sandbox transactions on the sandbox test site.
During the test phase, use the sandbox endpoints and your sandbox account details in each PayPal API request that you make. Create and manage your set of sandbox accounts from the sandbox Accounts page. Use the Sandbox test site to review the transactions associated with the calls you make using your sandbox accounts.
Tip: To review the status of the mock transactions associated with a sandbox account, log in to the sandbox test site with the credentials from any of your sandbox accounts.
The testing process
Test your application by creating a sandbox account for each user entity represented in your PayPal transactions. When testing, use the sandbox accounts in place of all the live accounts you will use while processing live transactions.
Tips on creating your PayPal developer account
When you create your developer account, PayPal does a verification check by sending an email to the address you specified. Enable your account by responding to PayPal’s email. If you don’t receive the verification email within a few minutes after signing up, check to see that it hasn’t been blocked or diverted to a spam folder.
Once your account is enabled, access the sandbox functionality by logging in to the PayPal Developer website using your developer account credentials.
When creating your PayPal developer account, consider creating an account that you don’t mind sharing with others on your development team. This way, you can share your sandbox accounts without compromising the security of your personal PayPal account.
Important: When coding your PayPal application, make sure that it behaves in accordance with the PayPal application policies and guidelines.
Sandbox accounts
Use sandbox accounts to generate mock transactions to test your app
Overview
The PayPal sandbox supports these account types:
Account type | Represents |
---|---|
Personal | The customer in a transaction. |
Business | The merchant in a transaction. |
To test a typical PayPal transaction, you must use both types of accounts.
When you register as a PayPal developer on the developer site, the PayPal sandbox creates these sandbox accounts:
You can create additional sandbox accounts on the developer site or directly on the sandbox site, https://www.sandbox.paypal.com.
Some PayPal transactions require more than one buyer-and-seller pair. For example, parallel payment calls and Adaptive calls each require two different business accounts but for different reasons. In these cases, you must create additional sandbox business accounts to play the roles of the entities in your transactions.
For information about sandbox account roles, see plan your sandbox accounts.
Create and manage sandbox accounts
Tip: To simplify the creation of multiple accounts, do one of the following:
Create a personal sandbox account
When you create a sandbox account, an email and password are generated. You use the email address to reference the sandbox account in your test API calls. You also use the email and password values to log in to the sandbox accounts page to view and configure the sandbox account.
To create an additional personal sandbox account:
A personal account with default values for balances and other information is created for you. If you need more customization of the test values, click Create Custom Account in the Create Sandbox Account dialog.
Create a business sandbox account
To create an additional business sandbox account:
A business account with default values for balances and other information is created for you. If you need more customization of the test values, click Create Custom Account in the Create Sandbox Account dialog.
Manage sandbox accounts
On the developer site sandbox accounts page, you can:
Change a sandbox account password
To change the account password:
Delete a sandbox account
To delete an account:
Link a sandbox account to your developer account
To link a pre-existing sandbox account to your developer account:
Note: If your sandbox account is already linked to another developer account, you cannot link it to your developer account.
Duplicate a sandbox account
If you have an existing Business or Personal test account, you can clone that account to create a new account of the same type. This can be helpful if you’re trying to model several merchants or customers that have slightly varying properties. By creating multiple sandbox accounts, you can test various payment flows and error scenarios.
After you clone an account, you can edit the PayPal balance, first name, last name, and email address. You must also set a password for the new account, the password is not cloned.
To duplicate a sandbox account:
Note: When you duplicate a sandbox account, the Pro status is disabled by default and any flags that have been set up by your Account Manager are not duplicated to the new account.
Some sandbox accounts have cloning disabled for the following reasons: