I am using the current REST API from PayPal on my page. But I am not able to hide the shipping information on PayPal. I don't want to offer the option to my customers to change the address in PayPal.
payment: function(data, actions) {
return actions.payment.create({
transactions: [{
amount: {
total: '<? print(number_format($got_daten["bestellwert"],2,".","")); ?>',
currency: 'EUR',
details: {
subtotal: '<? print(number_format($got_daten["bestellwert_slim"],2,".","")); ?>',
shipping: '<? print(number_format($got_daten["orderVersandkosten"],2,".","")); ?>'
}
},
description: 'Krusenhof Etteln - Onlinebestellung',
custom: 'Bestellung: <? print($got_daten["orderID"]); ?>',
}],
note_to_payer: 'Rufen Sie uns an bei Fragen! Ihr Krusenhof Etteln'
});
},
How can I add the option to hide (no shipping)?
All the documentations are for the old version and not work anymore.
You can do that with the Payment Experience API. Take a look at the example here. It shows no_shipping being used.
curl -v -X \
POST https://api.sandbox.paypal.com/v1/payment-experience/web-profiles/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer Access-Token" \
-d '{
"name": "ebayProfile",
"presentation":
{
"logo_image": "https://www.paypal.com"
},
"input_fields":
{
"no_shipping": 1,
"address_override": 1
},
"flow_config":
{
"landing_page_type": "billing",
"bank_txn_pending_url": "https://www.paypal.com"
}
}'
Related
How do I get the timestamp at which a PR review was request/re-requested? It shows as an event in the conversations tab in a PR so it must exist somewhere.
The pulls API endpoint show who has been requested to review but I can't see when.
"requested_reviewers": [
{
"login": "tamlyn",
...
},
],
Any ideas?
You're looking for the GitHub Timeline API. See the docs for the Timeline API here.
Request:
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
https://api.github.com/repos/OWNER/REPO/issues/ISSUE_NUMBER/timeline
Response:
...
{
"id": "12345",
...
"actor": {
"login": "user",
...
},
"event": "review_requested",
"created_at": "2022-01-01T01:01:01Z",
...
"review_requester": {
"login": "user",
...
},
"requested_reviewer": {
"login": "user2",
...
},
...
},
...
I am using Razorpay for the payment in an e- commerce app, Actually in only need card payment in the payment method of razorpay. But how can i remove all the external payment from the options.
You can configure the payment methods of your choice on the Checkout section of the Payment Links to provide a highly personalized experience for your customers.
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X POST https://api.razorpay.com/v1/payment_links/ \
-H 'Content-type: application/json' \
-d '{
"amount": 1000,
"currency": "INR",
"accept_partial": true,
"first_min_partial_amount": 100,
"reference_id": "#523442",
"description": "Payment for policy no #23456",
"customer": {
"name": "Gaurav Kumar",
"contact": "+919999999999",
"email": "gaurav.kumar#example.com"
},
"notify": {
"sms": true,
"email": true
},
"reminder_enable": true,
"options": {
"checkout": {
"method": {
//here you have to specify
"netbanking": "1",
"card": "1",
"upi": "0",
"wallet": "0"
}
}
}
}'
Edit
official docs: https://razorpay.com/docs/payments/payment-methods/
As an EU based seller I need to charge tax based on customer country tax rates and rules. That means that when I create subscription I need to specify either tax rate (percentage or amount) or have the ability to override subscription price. When using Stripe one just needs to specify tax_percent beside plan_id when creating subscription.
So far I wasn't able to do the same using PayPal Subscriptions API and their smart buttons. Tax rate can be set when creating plan but I need to be able to set tax percentage per subscription.
Sample smart button JS code:
paypal.Buttons({
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'P-2UF78835G6983425GLSM44MA',
// I'd like to be able to set tax rate here somehow
});
}
}).render('#paypal-button-container');
No luck setting up tax directly using Subscriptions API either:
curl -v -k -X POST https://api.sandbox.paypal.com/v1/billing/subscriptions \
-H "Accept: application/json" \
-H "Authorization: Bearer Access-Token" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "P-2UF78835G6983425GLSM44MA",
"application_context": {
"brand_name": "example",
"user_action": "SUBSCRIBE_NOW",
"payment_method": {
"payer_selected": "PAYPAL",
"payee_preferred": "IMMEDIATE_PAYMENT_REQUIRED"
},
"return_url": "https://example.com/returnUrl",
"cancel_url": "https://example.com/cancelUrl"
}
}'
Am I missing something, thinking about this incorrectly or did PayPal "forgot" to implement basic thing like tax rate and therefore make their new subscriptions API unusable for VAT MOSS scenarios?
You can add the tax override to the plan node as shown below
<script>
paypal.Buttons({
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'YOUR_PLAN_ID_HERE', // Creates the subscription
'plan': {
'taxes': {
'percentage': '2.9',
'inclusive': false
}}
});
},
onApprove: function(data, actions) {
alert('You have successfully created subscription ' + data.subscriptionID); // Optional message given to subscriber
}
}).render('#paypal-button-container'); // Renders the PayPal button
</script>
It's an old topic and still not possible. PayPal doesn't support taxes with subscriptions. You can price your subscription so it has the VAT included in it. Mention that the price includes VAT before a user is redirected to payment.
I highly recommend not to implement the tax rules yourself. Better let a 3rd party API handle correct calculations.
https://vatstack.com/rates
https://quaderno.io/checkout
https://www.octobat.com/products/vat-gst-sales-tax-engine
Recently I found out that this is possible. Not sure if this is something added fairly recently or was this option there all along.
While creating a subscription you can override a plan and set the tax percentage inline.
curl -v -k -X POST https://api.sandbox.paypal.com/v1/billing/subscriptions \
-H "Accept: application/json" \
-H "Authorization: Bearer Access-Token" \
-H "Content-Type: application/json" \
-d '{
"plan_id": "#PLANID",
...
"plan": {
"taxes": {
"percentage": "19",
"inclusive": false
}
}
}'
Taxes seem to be included in the Plan entity.
https://developer.paypal.com/docs/subscriptions/full-integration/plan-management/#show-plan-details
curl -v -X GET https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <Access-Token>
{
"id": "P-2UF78835G6983425GLSM44MA",
"product_id": "PROD-6XB24663H4094933M",
"name": "Basic Plan",
"status": "ACTIVE",
"description": "Basic plan",
"billing_cycles": [
{
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "TRIAL",
"sequence": 1,
"total_cycles": 1
},
{
"pricing_scheme": {
"fixed_price": {
"currency_code": "USD",
"value": "10.0"
}
},
"frequency": {
"interval_unit": "MONTH",
"interval_count": 1
},
"tenure_type": "REGULAR",
"sequence": 2,
"total_cycles": 12
}
],
"payment_preferences": {
"auto_bill_outstanding": true,
"setup_fee": {
"currency_code": "USD",
"value": "10.0"
},
"setup_fee_failure_action": "CONTINUE",
"payment_failure_threshold": 3
},
----------------------------------------
"taxes": {
"percentage": "10.0",
"inclusive": false
},
----------------------------------------
"quantity_supported": false,
"create_time": "2020-02-26T07:01:04Z",
"update_time": "2020-02-26T07:01:04Z",
"links": [
{
"href": "https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA",
"rel": "self",
"method": "GET"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA",
"rel": "edit",
"method": "PATCH"
},
{
"href": "https://api-m.sandbox.paypal.com/v1/billing/plans/P-2UF78835G6983425GLSM44MA/deactivate",
"rel": "self",
"method": "POST"
}
]
}
Do quick replies work in Facebook Messenger Bot Welcome Message? This is the message that is displayed after you press the "Get Started" button.
It might not be supported, but if it is, am I doing something wrong?
Here's what I'm trying:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [{
"title": "Hi dad",
"subtitle": "Hi mom",
"item_url": "www.google.com",
"image_url": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
}]
}
}
},
"quick_replies":[
{
"content_type":"text",
"title":"option1",
"payload":"option1payload"
},
{
"content_type":"text",
"title":"option2",
"payload":"option2payload"
}
]
}
]
}' "https://graph.facebook.com/v2.6/13333333337/thread_settings?access_token=THISISMYCOOLTOKEN"
The error I'm receiving is:
Invalid Keys \"message, quick_replies\" were found in param \"call_to_actions[0]\"."type":"OAuthException","code":100
Nope. payload is only for string text. see https://developers.facebook.com/docs/messenger-platform/thread-settings/get-started-button
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"USER_DEFINED_PAYLOAD"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
call_to_actions is limited to 1 call_to_actions must contain at least
one payload string.
This data will be sent back to you via webhook.
we are testing the subscription functionality using the APIv2. We are following the guidelines described in http://telefonicaid.github.io/fiware-orion/api/v2/ . We are able to create a correct subscription but the format of the notification messages that we received is not what we expected. The format of these messages is like the APIv1 version. Is this the expected behavior?
We are using the Docker image from https://hub.docker.com/r/fiware/orion/.
Version information about the build:
{
"orion" : {
"version" : "1.0.0-next",
"uptime" : "0 d, 1 h, 28 m, 47 s",
"git_hash" : "a729812c45d2749fffbc19add17631b2fffc8797",
"compile_time" : "Fri Apr 8 10:05:55 UTC 2016",
"compiled_by" : "root",
"compiled_in" : "838a42ae8431"
}
}
Steps to reproduce:
Create an entity:
(curl -X POST http://<cb_url>:<cb_port>/v2/entities?options=keyValues -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"type":"Room",
"id": "test",
"humidity":40
}
EOF
Create a subscription:
(curl -X POST http://<cb_url>:<cb_port>/v2/subscriptions -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"description": "One subscription to rule them all",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attributes": [
"humidity"
],
"expression": {
"q": "humidity>40"
}
}
},
"notification": {
"callback": "http://192.168.99.1:5000",
"attributes": [
"humidity"
],
"throttling": 5
},
"expires": "2016-05-05T14:00:00.00Z"
}
EOF
Update attribute.:
(curl -X PUT <cb_url>:<cb_port>/v2/entities/test/attrs/humidity/value -s -S --header 'Content-Type: application/json' \
--header 'Accept: application/json' -d #- | python -mjson.tool) <<EOF
{
"value": 50
}
EOF
We get the notification with the following format:
{u'contextResponses': [
{u'contextElement': {
u'attributes': [{
u'name': u'humidity',
u'type': u'none',
u'value': {u'value': 50}
}],
u'id': u'test',
u'isPattern': u'false',
u'type': u'Room'
},
u'statusCode': {
u'code': u'200',
u'reasonPhrase': u'OK'
}}],
u'originator': u'localhost',
u'subscriptionId': u'5707b72882fc213130f4e5b9'}
NGSIv2 notification formats have not been yet implemented (at Orion 1.0.0). Note that NGSIv2 is yet in beta status and sometimes the specification (where the new notification format has been defined) is a step forward the implementation.
There is a github issue about this, to which you can subscribe in order to know when this feature gets implemented.
EDIT: NGSIv2 notification formats have been implemented in Orion 1.1.0.