OK, PayPal's docs and examples are pain awful so I hope someone else could help me figure this out. I'm doing a PayPal SetExpressCheckout request using their NVP API. It seems that my code produces one-time payment and not a subscription (which I figured out when receiving IPNs in the single-payment format, not subscription format, also on the sandbox buyer/seller panel in paypal there is nothing that says that the payments in the history are recurring), so I want to know what am I doing wrong. Those are the key => value pairs that I use, of course I implode and send them to PayPal in the right manner - as I said it works but not the way I want it.
array
'METHOD' => string 'SetExpressCheckout' (length=18)
'PAYMENTREQUEST_0_AMT' => string '3.99' (length=4)
'PAYMENTREQUEST_0_CURRENCYCODE' => string 'USD' (length=3)
'PAYMENTREQUEST_0_PAYMENTACTION' => string 'Sale' (length=4)
'PAYMENTREQUEST_0_INVNUM' => int 93
'PAYMENTREQUEST_0_CUSTOM' => string '394mtrf1h5lfdeehvgrferk1n1' (length=26)
'LOCALECODE' => string 'EN' (length=2)
'NOSHIPPING' => int 1
'REQCONFIRMSHIPPING' => int 0
'RETURNURL' => string 'http://MYDOMAINXXXX.COM/payPal/return' (length=44)
'CANCELURL' => string 'http://MYDOMAINXXXX.COM/upgrade' (length=38)
'ALLOWNOTE' => int 0
'LANDINGPAGE' => string 'Billing' (length=7)
'EMAIL' => string 'dimitar#instinctiv.com' (length=22)
'BILLINGPERIOD' => string 'Month' (length=5)
'BILLINGFREQUENCY' => int 1
'PROFILESTARTDATE' => string '2011-07-26' (length=10)
'L_BILLINGTYPE0' => string 'RecurringPayments' (length=17)
'L_BILLINGAGREEMENTDESCRIPTION0' => string 'Basic Subscription - 25GB' (length=34)
'VERSION' => string '63.0' (length=4)
'USER' => string 'pro_1307543338_biz_api1.gmail.com' (length=33)
'PWD' => string 'XXXXXXXXX' (length=10)
'SIGNATURE' => string 'AdTGraIKTCQ-O2lYSLlGJVfeJ1FWAKhC6Y8qZZxqGGkKkccrGxO45emb' (length=56)
I suspect the problem might be PAYMENTREQUEST_0_AMT and the other PAYMENTREQUEST_N_XXX keys, as in the PayPal docs I see that "PAYMENTREQUEST_N_AMT" "SHOULD BE" set to 0 for recurring payments, but also in the docs they say that "AMT is used to point out the amount to be billed on each billing cycle and is deprecated, to use PAYMENTREQUEST_N_AMT instead"!?
Any help is appreciated. If you need more specific info I will provide everything, just add a comment.
You still have to call CreateRecurringPaymentsProfile to create the recurring payments profile. If you don't want to bill an initial amount, you could leave the AMT set to '0' for your SetExpressCheckout API call. See also https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_CreateRecurringPayments and Table 4.2 in https://www.paypalobjects.com/en_US/ebook/PP_ExpressCheckout_IntegrationGuide/RecurringPayments.html
Related
I am using php's OpenSSL Functions ( openssl_x509_parse ) to parse SSL certificate info of given site.
Sample Code:
$stream = stream_context_create(
array(
"ssl" => array(
"allow_self_signed" => true,
"capture_peer_cert" => true,
"capture_peer_cert_chain" => true,
"verify_peer" => false,
"verify_peer_name" => false,
"sni_enabled" => true,
),
)
);
$streamRead = #stream_socket_client("ssl://stackoverflow.com:443", $streamErrNo, $streamErrStr, 30, STREAM_CLIENT_CONNECT, $stream);
if (!$streamErrNo && $streamRead) {
$streamContext = stream_context_get_params($streamRead);
$streamContextMeta = stream_get_meta_data($streamRead);
$certChainsRes = $streamContext["options"]["ssl"]["peer_certificate_chain"];
$certChainArr = array();
for ($i = 0; $i < count($certChainsRes); $i++) {
$certChainData = openssl_x509_parse($certChainsRes[$i]);
var_dump($certChainData);
}
}
The code is working fine and it gives me data.
Sample Data.
array (size=16)
'name' => string '/C=US/ST=NY/L=New York/O=Stack Exchange, Inc./CN=*.stackexchange.com' (length=68)
'subject' =>
array (size=5)
'C' => string 'US' (length=2)
'ST' => string 'NY' (length=2)
'L' => string 'New York' (length=8)
'O' => string 'Stack Exchange, Inc.' (length=20)
'CN' => string '*.stackexchange.com' (length=19)
'hash' => string '07cc7bb0' (length=8)
'issuer' =>
array (size=4)
'C' => string 'US' (length=2)
'O' => string 'DigiCert Inc' (length=12)
'OU' => string 'www.digicert.com' (length=16)
'CN' => string 'DigiCert SHA2 High Assurance Server CA' (length=38)
'version' => int 2
'serialNumber' => string '9833040086282421696121167723365753840' (length=37)
'serialNumberHex' => string '0765C64E74E591D68039CA2A847563F0' (length=32)
'validFrom' => string '181005000000Z' (length=13)
'validTo' => string '190814120000Z' (length=13)
'validFrom_time_t' => int 1538697600
'validTo_time_t' => int 1565784000
'signatureTypeSN' => string 'RSA-SHA256' (length=10)
'signatureTypeLN' => string 'sha256WithRSAEncryption' (length=23)
'signatureTypeNID' => int 668
Questions:
1: I get details like signatureTypeSN, signatureTypeLN,
signatureTypeNID but how can I get Signature Algorithm Id (Hash
Algorithm OID) eg. sha256WithRSAEncryption => 1.2.840.113549.1.1.11
2: These details show that certificate's version is 2
'version' => int 2 but the browser shows that certificate version is 3 ![Screenshot of SSL Certificate Details in
browser]1
P.S: The code is running on Ubuntu 18.04 server with php7.3. The browser I am using is Mozilla Firefox on Windows 10.
#1. Version
About version number (From RFC: https://www.rfc-editor.org/rfc/rfc5280#section-4.1.2.1)
4.1.2.1. Version
This field describes the version of the encoded certificate. When
extensions are used, as expected in this profile, version MUST be 3
(value is 2). If no extensions are present, but a UniqueIdentifier
is present, the version SHOULD be 2 (value is 1); however, the
version MAY be 3. If only basic fields are present, the version
SHOULD be 1 (the value is omitted from the certificate as the default
value); however, the version MAY be 2 or 3.
Implementations SHOULD be prepared to accept any version certificate.
At a minimum, conforming implementations MUST recognize version 3
certificates.
Generation of version 2 certificates is not expected by
implementations based on this profile.
It means version 2 in output equals version 3 of certyficate.
#2. OID
About the first part of question, the easiest way is to find list and implement it as an array then normal replace. One of them i found on https://www.rfc-editor.org/rfc/rfc7427 (search for oid = )
Also in previous one RFC 7427 (https://www.rfc-editor.org/rfc/rfc5280) You can find those OID
I have an app in Laravel and I am following this tutorial. I cloned a sample repo from here and When I try to make a pyament form this, it gives me the following response
Caught exception!
Response body:
object(stdClass)[6]
public 'errors' =>
array (size=1)
0 =>
object(stdClass)[7]
public 'category' => string 'INVALID_REQUEST_ERROR' (length=21)
public 'code' => string 'VALUE_TOO_LOW' (length=13)
public 'detail' => string '`amount_money.amount` must be greater than 100.' (length=47)
public 'field' => string 'amount_money.amount' (length=19)
Response headers:
array (size=12)
0 => string 'HTTP/1.1 400 Bad Request' (length=24)
'Content-Type' => string 'application/json' (length=16)
'Vary' => string 'Origin, Accept-Encoding' (length=23)
'X-Content-Type-Options' => string 'nosniff' (length=7)
'X-Download-Options' => string 'noopen' (length=6)
'X-Frame-Options' => string 'SAMEORIGIN' (length=10)
'X-Permitted-Cross-Domain-Policies' => string 'none' (length=4)
'X-Xss-Protection' => string '1; mode=block' (length=13)
'Date' => string 'Sat, 29 Oct 2016 08:23:51 GMT' (length=29)
'Keep-Alive' => string 'timeout=60' (length=10)
'Strict-Transport-Security' => string 'max-age=631152000' (length=17)
'content-length' => string '161' (length=3)
It worked when i tried the sandbox.
How can I make square to charge any amount that is less than USD 100?
How can I validate the card i.e. in the form given in the github repo, they don't ask for card holder name?
How can I integrate other payment methods with square like cash or cheque?
It sounds like you are trying to make a web based point of sale. To answer your questions:
The minimum charge for Credit Cards, both in the Square Register app and the API is $1.00 (the 100 amount includes cents)
The cards are primarily validated with CVV and postal code, which you should see as required fields in the form.
At this time you cannot create payments for other tender types like cash or check through the API. (This is primarily because our transaction APIs are used for e-commerce exclusively, while custom point of sales are usually created with our Register APIs)
I'm trying to get some basic event info from a public google calendar. In PHP it looks like this:
$xml = simplexml_load_file('http://www.google.com/calendar/feeds/[username]/public/basic?start-min=2014-01-01T00:00:00&start-max=2016-03-24T23:59:59');
var_dump($xml);
This brings back the XML data as expected, with the event data.
public 'id' => string 'http://www.google.com/calendar/feeds/[username]/public/basic/k524jsujs242bag0fsqfveiij8' (length=98)
public 'published' => string '2014-01-29T21:04:51.000Z' (length=24)
public 'updated' => string '2014-01-29T22:12:20.000Z' (length=24)
public 'category' =>
object(SimpleXMLElement)[1996]
public '#attributes' =>
array (size=2)
'scheme' => string 'http://schemas.google.com/g/2005#kind' (length=37)
'term' => string 'http://schemas.google.com/g/2005#event' (length=38)
public 'title' => string 'busy' (length=4)
public 'summary' => string 'When: Thu Jan 30, 2014 11am to 12pm PST<br>' (length=49)
My problem is that in the events, none of the Titles are populated-- they all simply show "busy", even though there is a valid title saved in the actual calendar event.
Anyone know how to get the actual event title?
Problem was that the calendar, while public, wasn't set in the Google Apps admin to share ALL event data.
See here for more info: https://productforums.google.com/forum/#!topic/calendar/-YcGbl1uw5Y
I have created several static Segments in Mailchimp for a List.
I am writing some PHP to create campaigns, but I am stuck on a hurdle early on.
I am using v1.3 of the MailChimp API
$api = new MCAPI( $this->config['api_key'] );
$lists = $api->listStaticSegments( $list_id );
var_dump( $api );
var_dump( $lists );
Results:
object(MCAPI)[39]
public 'version' => string '1.3' (length=3)
public 'errorMessage' => string '' (length=0)
public 'errorCode' => string '' (length=0)
public 'apiUrl' =>
array (size=4)
'scheme' => string 'http' (length=4)
'host' => string 'api.mailchimp.com' (length=17)
'path' => string '/1.3/' (length=5)
'query' => string 'output=php' (length=10)
public 'timeout' => int 300
public 'chunkSize' => int 8192
public 'api_key' => string 'XXX' (length=XX)
public 'secure' => boolean false
array (size=0)
empty
I am expecting $lists to have 10 items in an array.
When I log into MailChimp and check the API Account API Keys page, I can see there are requests but there are no responses.
Ah ha. The problem was I had no static lists. The lists that I had created were dynamic segments (auto updating) , so therefore I must use campaignSegmentTest to generate the same criteria for the dynamic segments.
http://apidocs.mailchimp.com/api/1.3/campaignsegmenttest.func.php
Further research on the Google Mailchimp forum:
https://groups.google.com/forum/#!msg/mailchimp-api-discuss/63DLfYq7ydI/jyGASmUxK8AJ
Magento is started by running Mage::run() in index.php. Mage::run has three parameters: $code, $type, and $options. The first two are well-documented but I can't find anything about the third: $options.
I did read somewhere that you can move your etc directory to another place, but what other options can I set? I hope I can set the theme package; that's what I have been looking for.
I haven't personally used the third argument but after some investigation I've found out that they are used to set the Mage_Core_Model_Config options:
I've made a var_dump with the options and it looks something like this:
//excerpt from var_dump() of Mage_Core_Model_Config_Options
protected '_data' =>
array
'app_dir' => string '/var/www/magento/app' (length=36)
'base_dir' => string '/var/www/magento' (length=32)
'code_dir' => string '/var/www/magento/app/code' (length=41)
'design_dir' => string '/var/www/magento/app/design' (length=43)
'etc_dir' => string '/var/www/magento/app/etc' (length=40)
'lib_dir' => string '/var/www/magento/lib' (length=36)
'locale_dir' => string '/var/www/magento/app/locale' (length=43)
'media_dir' => string '/var/www/magento/media' (length=38)
'skin_dir' => string '/var/www/magento/skin' (length=37)
'var_dir' => string '/var/www/magento/var' (length=36)
'tmp_dir' => string '/var/www/magento/var/tmp' (length=40)
'cache_dir' => string '/var/www/magento/var/cache' (length=42)
'log_dir' => string '/var/www/magento/var/log' (length=40)
'session_dir' => string '/var/www/magento/var/session' (length=44)
'upload_dir' => string '/var/www/magento/media/upload' (length=45)
'export_dir' => string '/var/www/magento/var/export' (length=43)