need help to get transaction id description

xTottos
Contributor
Contributor

hey so i recently had a problem with integrating debit/credit cart to my shopify store but now i got it fixed however when a customer orders a product it doesn't show the product name it only shows the transaction id in numbers and i don't know what it refers to so i can't fulfil the order.Screenshot_10.png

as shown in the picture i want the product name or discerption is there anything i need to add in the code here is the code im using :

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>PayPal Standard Payments Integration | Client Demo</title>
</head>

<body>
<div id="paypal-button-container"></div>
<!-- Sample PayPal credentials (client-id) are included -->
<script src="https://www.paypal.com/sdk/js?client-id=AVZFrFWJLRuho8eGB9GeUvhMsij84I7PR-bzsq_WIpTZsAaCfku5BNwErLwn..." data-sdk-integration-source="integrationbuilder"></script>

<script>
const fundingSources = [
paypal.FUNDING.VENMO,
paypal.FUNDING.CARD
]

for (const fundingSource of fundingSources) {
const paypalButtonsComponent = paypal.Buttons({
fundingSource: fundingSource,

// optional styling for buttons
// https://developer.paypal.com/docs/checkout/standard/customize/buttons-style-guide/
style: {
shape: 'rect',
height: 40,
},

// set up the transaction
createOrder: (data, actions) => {
// pass in any options from the v2 orders create call:
// https://developer.paypal.com/api/orders/v2/#orders-create-request-body
const createOrderPayload = {
purchase_units: [
{
amount: {
value: {{ cart.total_price | divided_by:100.0 }}
},
},
],
}

return actions.order.create(createOrderPayload)
},

// finalize the transaction
onApprove: (data, actions) => {
const captureOrderHandler = (details) => {
const payerName = details.payer.name.given_name
console.log('Transaction completed!')
}

return actions.order.capture().then(captureOrderHandler)
},

// handle unrecoverable errors
onError: (err) => {
console.error(
'An error prevented the buyer from checking out with PayPal',
)
},
})

if (paypalButtonsComponent.isEligible()) {
paypalButtonsComponent
.render('#paypal-button-container')
.catch((err) => {
console.error('PayPal Buttons failed to render')
})
} else {
console.log('The funding source is ineligible')
}
}
</script>
</body>
</html>


 

Login to Me Too
1 REPLY 1

MTS_Chiranjeevi
Moderator
Moderator

Good day @xTottos,

 

Thank you for posting to the PayPal community.

 

Yes, while performing the "Create Order" API call, merchants need to pass the "items" value that the customer purchased which contains the name, quantity, description etc.

 

https://developer.paypal.com/docs/api/orders/v2/#orders_create

https://developer.paypal.com/docs/api/orders/v2/#orders_create!path=purchase_units/items&t=request 

 

Please use the "Show order details" API to get the particular order details.

 

https://developer.paypal.com/docs/api/orders/v2/#orders_get 

 

Sincerely,

Chiranjeevi

PayPal/Braintree MTS

 

If this post or any other was helpful, please enrich the community by giving kudos or accepting it as a solution.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.