0% found this document useful (0 votes)
20 views4 pages

Exercises - Day1

The document provides instructions for 7 exercises using the PayPal sandbox API. Exercise 1 involves making a SOAP request to add two numbers. Exercise 2 makes a POST request to list country names. Exercise 3 obtains an access token by making a request with basic authentication. Exercise 4 creates an order by making a POST request and saves the order ID. Exercise 5 shows order details by GET request. Exercises 6 and 7 make GET requests to list transactions and balances respectively.

Uploaded by

MSCRM Solution
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views4 pages

Exercises - Day1

The document provides instructions for 7 exercises using the PayPal sandbox API. Exercise 1 involves making a SOAP request to add two numbers. Exercise 2 makes a POST request to list country names. Exercise 3 obtains an access token by making a request with basic authentication. Exercise 4 creates an order by making a POST request and saves the order ID. Exercise 5 shows order details by GET request. Exercises 6 and 7 make GET requests to list transactions and balances respectively.

Uploaded by

MSCRM Solution
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Exercise 1:

Host:
http://www.dneonline.com

Resources :
/calculator.asmx

Header :
Content-Type

text/xml; charset=utf-8

Body:

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs


d="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/
envelope/">
<soap:Body>
<Add xmlns="http://tempuri.org/">
<intA>2</intA>
<intB>2</intB>
</Add>
</soap:Body>
</soap:Envelope>

Expected outcome : 4

Add Assertion to validate HTTP status code : 200

Exercise 2: - POST Request

List Countries by name:

Host : http://webservices.oorsprong.org
Resources : /websamples.countryinfo/CountryInfoService.wso

Header :
Content-Type

text/xml; charset=utf-8

Body:

<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<ListOfCountryNamesByName xmlns="http://www.oorsprong.org/
websamples.countryinfo">
</ListOfCountryNamesByName>
</soap12:Body>
</soap12:Envelope>
Expected outcome: List of countries.

Assertion: Validate Afghanistan string appears in the response


Tip: Use Response body: contains string assertion.

Exercise 3: - POST REQUEST

Authorization :

End point
https://api-m.sandbox.paypal.com/v1/oauth2/token

Basic authorization :

Username

AUv8rrc_P-EbP2E0mpb49BV7rFt3Usr-vdUZO8VGOnjRehGHBXkSzchr37SYF2GNdQFYSp72jh5QUhzG

Password.

EMnAWe06ioGtouJs7gLYT9chK9-2jJ--7MKRXpI8FesmY_2Kp-d_7aCqff7M9moEJBvuXoBO4clKtY0v

Body :

x-www-form-urlencoded

key
grant_type

value

client_credentials

Note : This API will get you the access token and this should be used in the upcoming requests.

Create Order: POST Request - REST


https://api-m.sandbox.paypal.com/v2/checkout/orders

Note:

1. Perform Chaining process to get the OrderId and save it as global variable
2. Use the access token at the collection level
3. Authorization : Use inherit from parent for the request.
4. Assertion for 201 status code

Body:
{
"intent": "CAPTURE",
"purchase_units": [
{
"items": [
{
"name": "T-Shirt",
"description": "Green XL",
"quantity": "1",
"unit_amount": {
"currency_code": "USD",
"value": "100.00"
}
}
],
"amount": {
"currency_code": "USD",
"value": "100.00",
"breakdown": {
"item_total": {
"currency_code": "USD",
"value": "100.00"
}
}
}
}
],
"application_context": {
"return_url": "https://example.com/return",
"cancel_url": "https://example.com/cancel"
}
}

Ex#5

show Order: GET Request

https://api-m.sandbox.paypal.com/v2/checkout/orders/:order_id

Note:

1. Path Variable to be set.


2. Authorization: should be inherit from parent

Transaction Details : - GET REQUESTS

List Transactions :

https://api-m.sandbox.paypal.com/v1/reporting/transactions?
fields=transaction_info,payer_info,shipping_info,auction_info,cart_info,incentive_info,store_info&start_date=2022-
02-20T23:59:59.999Z&end_date=2022-03-20T00:00:00.000Z
Ex#7

List All balances:

m.sandbox.paypal.com /v1/reporting/balances?as_of_time=2022-03-
20T00:00:00.000Z&currency_code=ALL&include_crypto_currencies=true

You might also like