Stripe Subscription

时间:2017-06-22 15:22:04

标签: java grails gson stripe-payments stripe-connect

我正在尝试将条带整合到Grails 2.2.1中。 Stripe-java-5.4.0和gson-2.2.4-sources.jar。我在视图中使用了js脚本。但我得到com.stripe.net.APIResource错误。

进口是

import com.stripe.model.Subscription
import com.stripe.net.APIResource
import com.stripe.Stripe
import com.google.gson.*

最后3次导入未使用。

查看

<g:form controller="home" action="stripePayment" class="register-form" role="form">
        <script
                src="https://checkout.stripe.com/checkout.js" class="stripe-button"
                data-key="pk_test_xxx"
                data-amount="2000"
                data-name="Demo Site"
                data-description="2 widgets ($20.00)"
                data-image="../images/logo.png">
        </script>
    </g:form>

控制器

def stripePayment(){
        String token = params.stripeToken;

        Stripe.apiKey = "sk_test_xxx"; test

        Map<String, Object> params = new HashMap<String, Object>();
        params.put("email", "test@test.test");

        Customer customer = Customer.create(params);

    }

错误

  stripeToken: tok_1AXWxW2eZvKYlo2CKovnV4Hl
stripeTokenType: card
stripeEmail: test@test.test
com.stripe.net.APIResource. Stacktrace follows:
Message: Executing action [stripePayment] of controller [safety4truckers.HomeController]  caused exception: Runtime error executing action
    Line | Method
->>  195 | doFilter  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread

Caused by ControllerExecutionException: Runtime error executing action
->>  195 | doFilter  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread

Caused by InvocationTargetException: null
->>  195 | doFilter  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread

Caused by NoClassDefFoundError: com.stripe.net.APIResource
->>  274 | forName   in java.lang.Class
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|     30 | stripePayment in safety4truckers.HomeController$$EQNI4WN9
|    195 | doFilter  in grails.plugin.cache.web.filter.PageFragmentCachingFilter
|     63 | doFilter  in grails.plugin.cache.web.filter.AbstractFilter
|   1145 | runWorker in java.util.concurrent.ThreadPoolExecutor
|    615 | run       in java.util.concurrent.ThreadPoolExecutor$Worker
^    745 | run . . . in java.lang.Thread

0 个答案:

没有答案