How do i get the name of the Transaction in the PayPal-Transaction? For Example: the Messagefield in PayPal when you send Money or the Name of the Ebay Title if you buy something
Current request works, iam getting all fields accept a title/message for each transaction
My current CODE
<?php
$info = 'USER=pp2_api1.fdd.com'
.'&PWD=s8LW9QSdsdQ'fdgfQ49BGnB2EtG7ZgE.-sgUqA1s-RyHsMfsFrssUOnsREbod1'
.'&METHOD=TransactionSearch'
.'&TRANSACTIONCLASS=RECEIVED'
.'&STARTDATE=2013-01-08T05:38:48Z'
.'&ENDDATE=2013-07-14T05:38:48Z'
.'&VERSION=94';
$curl = curl_init('https://api-3t.paypal.com/nvp');
?>
Ok works just with "GetTransactionDetails"
Related
I am writing my first Shopify app that will unpublish a product once its inventory level goes below threshold.
For that I register a webhook with callback URL http://example.com/script.php that will be called by Shopify once product update event occurs.
In script.php how do I obtain Shopify API token to make PUT request to products/update to unpublish it?
Here is my script.php so far (I know I am missing hmac validation but that is not the point):
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST'){
session_start();
require 'shopify.php';
$api_key = 'api_key';
$secret = 'secret';
$sc = new ShopifyClient($_SERVER['HTTP_X_SHOPIFY_SHOP_DOMAIN'], $_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256'], $api_key, $secret);
$inventory = $_POST['inventory_quantity'];
$old_inventory = $_POST['old_inventory_quantity'];
if($inventory <= 0){
$args = array("product" => array("id" => $_SERVER['HTTP_X_SHOPIFY_PRODUCT_ID'], "published" => false));
$sc->call("PUT","/admin/products/".$_SERVER['HTTP_X_SHOPIFY_PRODUCT_ID'].".json",$args);
}
}
I am trying to use $_SERVER['HTTP_X_SHOPIFY_HMAC_SHA256'] but obviously that is wrong.
Shopify sends you the name of the shop in the header of every webhook. So your webhook can now authenticate the incoming call, and with the shop name, you simply query your persistence layer for the matching shop credentials. If you find the shop, you can open up an API session very easily, since you have the two things you need:
shopify domain name of the store
shopify access token
Note that a better way to hide products is to consider listening to the orders webhooks, which provide orders and products, and then query the inventory level of the product sold. Working off of product/update webhooks could be super obnoxious in terms of the number of calls you might have to process in comparison to orders.
I am using the PayPal API in C# and calling the .SetExpressCheckout() with a return url of:
http://www.MyWebsite.com/Success?transactionId={DynamicToken}
Is it possible that PayPal isn't returning the transactionId token that I have specified or is that improbable? I am trying to diagnose a few random errors (from hundreds of successful transactions) and wondering would it ever drop the parameter I have specified in the Return URL?
Also is it safe to assume that if PayPal returns 'Successful' but I DONT call .DoExpressCheckout() that no money has been taken and I can start again?
SetExpressCheckout will always return a response something like this:
NVP Response:
TOKEN=EC-8FL80454MK5202351
TIMESTAMP=2015-09-10T02:53:36Z
CORRELATIONID=bff60e96e81c4
ACK=Success
VERSION=109.0
BUILD=000000
and you will need to redirect to the checkout page
https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-8FL80454MK5202351
Once the buyer login and completes, it will redirect to your returnurl+EC-token+payerid
http://index.php?action=ECreturn&token=EC-8FL80454MK5202351&PayerID=7SGRP23PR8MWY
So, PayPal always does return the EC-Token and after this you will need to call Doexpresscheckout API to complete the payment without this the transaction is not complete.
VERSION = 109.0
METHOD = DoExpressCheckoutPayment
TOKEN = EC-8FL80454MK5202351
PAYMENTACTION = Sale
PAYERID = 7SGRP23PR8MWY
AMT = 0.01
for example if you have a return url like this
RETURNURL = index.php?action=ECreturn?test=1
then it after Setexpresscheckout is complete, Paypal will redirect to the following URL
index.php?action=ECreturn?test=1&token=EC-5K62958L49079615&PayerID=7SGRP23PR8MWY
I integrated the Omnipay PayPal express.
After the completePurchase() I need the PayPal buyer email adress.
I can access the Transaction ID with $data['PAYMENTINFO_0_TRANSACTIONID'] and also the Payer ID through $_GET['PayerID'].
Any ideas how to get the buyers email?
After completePurchase(), you need to fetch the checkout datas:
$response = $gateway->fetchCheckout($parameters)->send();
$data = $response->getData();
// you can check the full received data
print "<pre>";
var_dump($data);
And in this array, you've got a $data["EMAIL"] variable, wich stores the payer's e-mail address.
Regards!
P.s.: For more information and a TL;DR disquisition, check this.
This site tries to explain the process: http://admin.wechat.com/wiki/index.php?title=Access_token
The problem is nowhere do they tell you where to get the AppID or what exactly the secret is.Has anyone else succeeded in communicating with WeChat?
Essentially we # WeChat have 2 types of accounts, subscription and service. Subscription account only gives you access to the Message API which allows for receiving messages and autoresponses and allows you to broadcast to your users once a day. Subscription accounts are also grouped in a category in your contacts under subscription.
A service account gives you an APP ID and APP SECRET which allows you to generate an access token which is needed for pretty much all the other API's apart from the Message API. A service account displays in the user's contact list under the main chats in between all your other normal contacts. You can only broadcast to each of your users once a month on a service account.
If you have a service account you will get the APP ID and APP SECRET from admin.wechat.com -> login -> function -> advanced -> developer mode -> Just under your token you will see the APP ID and APP SECRET
To see what type of account you have go to admin.wechat.com -> login and then look at the top right of the screen next to your account name you will see your account name and just above that it will either say subscription account or service account.
If you want to test all the API's I recommend going to the developer sandbox environment where you get full access to all the API's: How does link with href for Line and Wechat?
Please note your number needs to be in the international format so 072 111 2233 you have to enter as +27721112233
Login http://admin.wechat.com
[advanced] --> [Developer Mode], you will got your Appid & AppSecret.
You don't have a wechat OA account?
Join [WeChat Space] https://plus.google.com/communities/102783597675617808511
You may go to http://dev.wechat.com/ to sign up for a developer account.
After you sign up, you will get your App ID and AppKey via your signup email.
Then, you can go to http://admin.wechat.com/wiki/index.php?title=Main_Page to obtain more information.
I wrote a code snippet on github that explains the entire process. The code is for django but can be used with any python framework
here is a snippet
import xml.etree.ElementTree as ET
from wechat.views import WeChatView
MyCustomView(WeChatView):
token = "ad4sf65weG7Db6ddWE"
on_message(self, message):
root = ET.fromstring(message)
from = root[1].text
message_type = root[3].text
content = root[4].text
print('from: {}'.format(from))
print('message type: {}'.format(message_type))
print('content: {}'.format(content))
The full code is here https://github.com/tawanda/django-wechat
Here's my code,maybe you can try it.
//Getting access_token from customize menus
static function get_access_token($appid,$secret){
$url="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=".$appid."&secret=".$secret;
$json=http_request_json($url);//here cannot use file_get_contents
$data=json_decode($json,true);
if($data['access_token']){
return $data['access_token'];
}else{
return "Error occurred while geting the access_token";
}
}
//Though URL request is https',cannot use file_get_contents.Using CURL while asking the JSON data
function http_request_json($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
I am creating a CIM API for authorize.net. I have it all working perfectly, but I need the transaction id to be returned to me when a transaction is created.
Right now, this what I have being returned when I complete a transaction:
if ($cim->isSuccessful())
{
$approval_code = $cim->getAuthCode();
}
// Print the results of the request
echo '<strong>Request Response Summary:</strong> ' .
$cim->getResponseSummary() . '';
echo '<strong>Approval code:</strong> ' . $approval_code;
Then this is the output I get: Request Response Summary: Response code: I00001 Message: Successful.Approval code: NXD8X7
No transaction ID is returned. I want to know how I can go about getting this. My goal is to write this to my database, but I need some way to get the transaction id. Thank you very much.
If you are using AuthorizeNet SDK you can get all response fields as an object with calling $response->getTransactionResponse function like following.
$request = new AuthorizeNetCIM();
$response = $request->createCustomerProfileTransaction('AuthCapture', $transaction);
$transactionResponse = $response->getTransactionResponse();
$transactionResponse->transaction_id